From: Eric Breck <ebreck@cs.cornell.edu>
To: caml-list@inria.fr
Subject: changing the type of records using "with"
Date: Wed, 12 Jul 2006 09:56:58 -0400 [thread overview]
Message-ID: <C54E1B4E-FF0D-4B79-88CA-8088605DD721@cs.cornell.edu> (raw)
Hi folks,
I noticed the following behavior of the typing system:
# type 'a foo = {a: 'a; b: int};;
type 'a foo = { a : 'a; b : int; }
# let one = { a = (); b = 5};;
val one : unit foo = {a = (); b = 5}
# let two = {one with a = "Hello"};;
val two : string foo = {a = "Hello"; b = 5}
i.e. "{one with ... }" can have a different polymorphic type argument
than "one" does. This has been handy for me on a couple of
occasions, but is it a documented feature that I can count on working
in future versions of ocaml, or is it a quirk of the current version?
thanks,
Eric Breck
next reply other threads:[~2006-07-12 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-12 13:56 Eric Breck [this message]
2006-07-13 2:43 ` [Caml-list] " Jacques Garrigue
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=C54E1B4E-FF0D-4B79-88CA-8088605DD721@cs.cornell.edu \
--to=ebreck@cs.cornell.edu \
--cc=caml-list@inria.fr \
/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;
as well as URLs for NNTP newsgroup(s).