From: Jeremy Yallop <yallop@gmail.com>
To: Andre Nathan <andre@digirati.com.br>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] GADTs and Menhir
Date: Wed, 1 Apr 2015 13:27:36 +0100 [thread overview]
Message-ID: <CAAxsn=F1Q9d=SLoH=p2n6u8pSmmfTdrnU_Z9Y7kA71Wfgj89Ww@mail.gmail.com> (raw)
In-Reply-To: <551BE19E.3010302@digirati.com.br>
On 1 April 2015 at 13:16, Andre Nathan <andre@digirati.com.br> wrote:
> I'm happy that it works, but the `any` type is a bit of a mistery to me.
> In Jeremy's email it's explained as
>
> "An existential to hide the type index of a well-typed AST, making it
> possible to write functions that return constructed ASTs whose type is
> not statically known."
>
> Does anyone have a reference to literature that explains this technique
> (I'm guessing that would be Pierce's book)? The OCaml manual briefly
> shows an example with a `dyn` type, but not much is said about it.
There's a more detailed explanation of the technique in the lecture
notes on the following page:
http://www.cl.cam.ac.uk/teaching/1415/L28/materials.html
The section you want is
8.4.2 Pattern: building GADT values
on p83 of the notes from 9 February, but it might also be helpful to
look through some of the earlier notes for background.
Jeremy.
next prev parent reply other threads:[~2015-04-01 12:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 18:16 Andre Nathan
2015-03-31 19:45 ` Francois Pottier
2015-03-31 20:41 ` Andre Nathan
2015-04-01 12:16 ` Andre Nathan
2015-04-01 12:27 ` Jeremy Yallop [this message]
2015-04-01 12:43 ` Andre Nathan
2015-04-01 13:16 ` Gerd Stolpmann
2015-04-01 18:12 ` Andre Nathan
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='CAAxsn=F1Q9d=SLoH=p2n6u8pSmmfTdrnU_Z9Y7kA71Wfgj89Ww@mail.gmail.com' \
--to=yallop@gmail.com \
--cc=andre@digirati.com.br \
--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