From: brogoff <brogoff@speakeasy.net>
To: Jeremy Yallop <j.d.yallop@sms.ed.ac.uk>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Oddness with recursive polymorphic variants
Date: Thu, 4 May 2006 17:01:30 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0605041656521.9940@shell3.speakeasy.net> (raw)
In-Reply-To: <445A4ED7.9080900@sms.ed.ac.uk>
On Thu, 4 May 2006, Jeremy Yallop wrote:
> Thanks for the reply. That doesn't seem to be what I want, though. The
> input to k should have type 'f'. The output should have type 'g'. Your
> 'k' can be called with values that don't match type 'f':
>
> # k `C;;
> - : g = `C
>
> The following does what I want:
>
> let k (#f as x:f) = (x:g)
>
> I'd like to understand why it behaves differently from the following:
>
> let k (x:f) = (x:g)
Right, others have shown that you can do what you want with a coercion. The
problem is that you are using exact types ("[" rather than "[>" ) and there
is a mismatch of exact types. ":" is not a coercion, it just tells the type
that should be there. ":>" coerces. x is not of type g, but it can be coerced to
g.
-- Brian
next prev parent reply other threads:[~2006-05-05 0:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-04 15:54 Jeremy Yallop
2006-05-04 17:10 ` [Caml-list] " Luc Maranget
2006-05-04 18:26 ` Michael Wohlwend
2006-05-04 18:33 ` brogoff
2006-05-04 18:58 ` Jeremy Yallop
2006-05-05 0:01 ` brogoff [this message]
2006-05-05 6:43 ` Luc Maranget
-- strict thread matches above, loose matches on Subject: below --
2006-05-04 15:50 Jeremy Yallop
2006-05-04 19:03 ` [Caml-list] " Nils Gesbert
2006-05-04 20:30 ` Nils Gesbert
2006-05-05 8:04 ` Jeremy Yallop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0605041656521.9940@shell3.speakeasy.net \
--to=brogoff@speakeasy.net \
--cc=caml-list@inria.fr \
--cc=j.d.yallop@sms.ed.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox