From: Jacques Le Normand <rathereasy@gmail.com>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Generalized Algebraic Datatypes
Date: Fri, 29 Oct 2010 11:53:48 -0400 [thread overview]
Message-ID: <AANLkTikM0-ANgozwLriqdot3b9D7=LBPRHxaY8Kiz=EO@mail.gmail.com> (raw)
In-Reply-To: <904846.44200.qm@web111513.mail.gq1.yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]
Assuming I understand this syntax, the following currently valid type
definition would have two interpretations:
type 'a t = IntLit of 'a constraint 'a = int
One interpretation as a standard constrained ADT and one interpretation as a
GADT. We could use another token, other than constraint, for example:
type 'a t = IntLit of 'a : 'a = int
to which I have no objections. As you pointed out, though, the current
syntax is more concise.
cheers,
--Jacques
On Fri, Oct 29, 2010 at 10:32 AM, Dario Teixeira <darioteixeira@yahoo.com>wrote:
> Hi,
>
> > I am pleased to announce an experimental branch of the O'Caml compiler:
> > O'Caml extended with Generalized Algebraic Datatypes. You can find more
> > information on this webpage:
>
> I have a couple of questions regarding the syntax you've chosen for GADT
> declaration. For reference, let's consider the first example you've
> provided:
>
> type _ t =
> | IntLit : int -> int t
> | BoolLit : bool -> bool t
> | Pair : 'a t * 'b t -> ('a * 'b) t
> | App : ('a -> 'b) t * 'a t -> 'b t
> | Abs : ('a -> 'b) -> ('a -> 'b) t
>
>
> There's something "Haskellish" about this syntax, in the sense that type
> constructors are portrayed as being like functions. While this does make
> sense in Haskell, in Ocaml it feels a bit out of place, because you cannot,
> for example, partially apply a type constructor.
>
> Also, note that in all the variant declarations the final token is 't'.
> Are there any circumstances at all where a GADT constructor will not end
> by referencing the type being defined? If there are not, then this syntax
> imposes some syntactic salt into the GADT declaration.
>
> I know this is not the sole syntax that was considered for GADTs in Ocaml.
> Xavier Leroy's presentation in CUG 2008 shows a different one, which even
> though slightly more verbose, does have the advantage of being more
> "Camlish".
> Is there any shortcoming to the 2008 syntax that resulted in it being
> dropped
> in favour of this new one?
>
> Best regards,
> Dario Teixeira
>
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 2772 bytes --]
next prev parent reply other threads:[~2010-10-29 15:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 14:32 Dario Teixeira
2010-10-29 15:03 ` Jacques Le Normand
2010-10-29 15:19 ` Sylvain Le Gall
2010-10-29 15:53 ` Jacques Le Normand [this message]
[not found] ` <129751088.61814.1288367649864.JavaMail.root@zmbs4.inria.fr>
2010-10-29 16:02 ` [Caml-list] " Xavier Leroy
2010-10-29 16:42 ` Dario Teixeira
2010-10-29 21:10 ` Stefan Monnier
2010-10-29 21:37 ` [Caml-list] " bluestorm
2010-10-29 23:01 ` Jacques Le Normand
2010-10-30 5:14 ` Jacques Garrigue
2010-10-30 13:04 ` Jacques Carette
2010-10-30 13:50 ` Dario Teixeira
2010-10-31 14:15 ` Wojciech Daniel Meyer
2010-10-31 14:35 ` Sylvain Le Gall
2010-10-31 14:49 ` [Caml-list] " Lukasz Stafiniak
2010-10-31 15:08 ` Sylvain Le Gall
2010-10-31 15:31 ` [Caml-list] " Lukasz Stafiniak
2010-10-29 22:05 ` Wojciech Daniel Meyer
2010-10-30 13:35 ` Dario Teixeira
-- strict thread matches above, loose matches on Subject: below --
2010-10-25 10:17 [Caml-list] " Dario Teixeira
2010-10-25 8:39 Jacques Le Normand
2010-10-25 9:44 ` [Caml-list] " bluestorm
2010-10-26 5:30 ` Jacques Le Normand
2010-10-27 21:07 ` Florian Hars
2008-04-28 5:35 Generalized algebraic datatypes Jacques Le Normand
2008-04-28 6:50 ` [Caml-list] " Gabriel Kerneis
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='AANLkTikM0-ANgozwLriqdot3b9D7=LBPRHxaY8Kiz=EO@mail.gmail.com' \
--to=rathereasy@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=darioteixeira@yahoo.com \
/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