From: "Lukasz Stafiniak" <lukstafi@gmail.com>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] How do I get polymorphic partial application?
Date: Sun, 24 Jun 2007 00:25:09 +0200 [thread overview]
Message-ID: <4a708d20706231525i7a33eee5iebf62b5ff39d8c2e@mail.gmail.com> (raw)
In-Reply-To: <9d3ec8300706231509p373e494ci1b05987fb3723e69@mail.gmail.com>
On 6/24/07, Till Varoquaux <till.varoquaux@gmail.com> wrote:
> As said previously, in a HM type ineference system type variables are
> generalized only in "let", that is:
>
> let id x = x (*starting with an identity function*)
> let id'= id id (*this is a partial application; it has type '_a ->'_a*)
> let _=
> print_string (id' "a");
> print_int (id' 4)
>
> won't work (since id' has type '_a->'_a).
>
> Replacing the definition of id' with the eta expanded version (let id'
> x = (id id) x) will however work. It is not 100% equivalent since
> every application of the new id' goes twice through id whilst the old
> was a reference to id....
>
> I hope this answers your question.
> Cheers,
> Till
No, it is related to the so called "value restriction" made Caml-ish
way, in a pure functional (no references) HM types can be generalized.
And I restate my question: can someone give an example, where if the
top-level let-definition types were generalized, this would lead to a
crash?
next prev parent reply other threads:[~2007-06-23 22:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-23 18:55 Till Varoquaux
2007-06-23 21:41 ` [Caml-list] " Philippe Wang
2007-06-23 21:49 ` Lukasz Stafiniak
2007-06-23 22:09 ` Till Varoquaux
2007-06-23 22:25 ` Lukasz Stafiniak [this message]
2007-06-23 22:11 ` Philippe Wang
2007-06-23 22:28 ` Lukasz Stafiniak
2007-06-23 22:07 ` Zheng Li
2007-06-23 22:09 ` Zheng Li
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=4a708d20706231525i7a33eee5iebf62b5ff39d8c2e@mail.gmail.com \
--to=lukstafi@gmail.com \
--cc=caml-list@yquem.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