From: Karl Zilles <zilles@1969.ws>
To: yminsky@cs.cornell.edu
Cc: Caml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Another polymorphism puzzle
Date: Thu, 31 Mar 2005 18:32:21 -0800 [thread overview]
Message-ID: <424CB2B5.1060309@1969.ws> (raw)
In-Reply-To: <891bd339050331180214df95db@mail.gmail.com>
Yaron Minsky wrote:
> The last example I posted about had to do with variant types. Here's
> another interseting little typing surprise having to do with record
> types:
>
> # type 'a t = { foo: 'a };;
> type 'a t = { foo : 'a; }
> # let f x = { x with foo = 3 };;
> val f : 'a -> int t = <fun>
>
> I can kind of see how this happened, since after all, the result of (f
> x) does not depend in any way on x. And yet, it seems like the
> unification rules should force f to have time ('a t -> int t).
Wow. This is pretty cool. Also
# type 'a t = { foo: 'a; bar: int };;
type 'a t = { foo : 'a; bar : int; }
# let f x = { x with foo = 3 };;
val f : 'a t -> int t = <fun>
(now the domain is limited to 'a t)
# f { foo= "blah"; bar=100 };;
- : int t' = {foo = 3; bar = 100}
next prev parent reply other threads:[~2005-04-01 2:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-01 2:02 Yaron Minsky
2005-04-01 2:32 ` Karl Zilles [this message]
2005-04-01 2:52 ` [Caml-list] " Manos Renieris
2005-04-01 4:29 ` Jacques Garrigue
2005-04-01 9:45 ` Alex Baretta
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=424CB2B5.1060309@1969.ws \
--to=zilles@1969.ws \
--cc=caml-list@inria.fr \
--cc=yminsky@cs.cornell.edu \
/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