From: Jeremie Dimino <jdimino@janestreet.com>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] why is this definition less general?
Date: Thu, 27 Aug 2015 11:11:23 +0100 [thread overview]
Message-ID: <CANhEzE7dZjLXbqd=J7Z_z36rRugJyPZCocN=+T+KX0sOEraJ2A@mail.gmail.com> (raw)
In-Reply-To: <55DEDF9B.5020006@tu-berlin.de>
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
On Thu, Aug 27, 2015 at 10:59 AM, Christoph Höger <
christoph.hoeger@tu-berlin.de> wrote:
> Obviously, 'a is bound by its first occurrence in the type annotation,
> here. Can someone explain this behavior?
In a type annotation, the scope of variables is only the type annotation.
So in your example the ['a] in the annotation of [a_to_opt] and the ['a] in
the annotation of [None] are distinct. To refer to the same type, you need
to use a local abstract type:
let rec a_to_opt : type a. (a -> a option) = fun x -> (None : a
option
)
--
Jeremie
[-- Attachment #2: Type: text/html, Size: 1394 bytes --]
prev parent reply other threads:[~2015-08-27 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 9:59 Christoph Höger
2015-08-27 10:11 ` Jeremie Dimino [this message]
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='CANhEzE7dZjLXbqd=J7Z_z36rRugJyPZCocN=+T+KX0sOEraJ2A@mail.gmail.com' \
--to=jdimino@janestreet.com \
--cc=caml-list@inria.fr \
--cc=christoph.hoeger@tu-berlin.de \
/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