Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Le Normand <rathereasy@gmail.com>
To: Lukasz Stafiniak <lukstafi@gmail.com>
Cc: caml-list caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] GADT constructor syntax
Date: Sat, 4 Dec 2010 16:06:56 -0500	[thread overview]
Message-ID: <AANLkTi=tXmna=Rk5nyQbYWNambBYUUk1=nRS=aGC0cfV@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimRki9EfbN0ekQQA2RmaQ2u28pHuvy37-eLhtxq@mail.gmail.com>

in this case, yes, but if you have constraints then it is different. consider:

type 'a term =
      | Ignore of 'a : int term
      | Embed of 'a
   constraint 'a = int

this is different from:

type 'a term =
     | Ignore of 'a : int term
     | Embed of 'a : 'a term
   constraint 'a = int

(in fact, an error is flagged on the second one)

Also, it can save the user some typing.

On Sat, Dec 4, 2010 at 4:00 PM, Lukasz Stafiniak <lukstafi@gmail.com> wrote:
> On Sat, Dec 4, 2010 at 9:54 PM, Jacques Le Normand <rathereasy@gmail.com> wrote:
>> you may want to name your type parameters because you can mix GADT
>> constructors with normal constructors. consider:
>>
>> type 'a term =
>>     | Ignore of 'a term : int term
>>     | Embed of 'a
>>
>> I don't think propagating type parameters is a good idea. The current
>> rule is: ignore type parameters in GADT constructors. This is simpler
>> than unifying the type parameters with the arguments of the return
>> type of the constructor.
>
> But it expands to:
>
>> type 'a term =
>>     | Ignore of 'a term : int term
>>     | Embed of 'a : 'a term
>


  reply	other threads:[~2010-12-04 21:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04 19:25 Jacques Le Normand
2010-12-04 19:36 ` [Caml-list] " gasche
2010-12-04 19:39 ` Basile Starynkevitch
2010-12-04 19:41 ` Lukasz Stafiniak
2010-12-04 20:14   ` Jacques Le Normand
2010-12-04 20:22     ` Lukasz Stafiniak
2010-12-04 20:54       ` Jacques Le Normand
2010-12-04 21:00         ` Lukasz Stafiniak
2010-12-04 21:06           ` Jacques Le Normand [this message]
2010-12-05  8:10             ` Lukasz Stafiniak
2010-12-05  8:16               ` Lukasz Stafiniak
2010-12-05  8:25               ` Lukasz Stafiniak
2010-12-05  8:35                 ` bluestorm
2010-12-06  0:21                   ` Jacques Garrigue
     [not found] <1245532236.1431213.1291490707868.JavaMail.root@zmbs3.inria.fr>
2010-12-06  9:11 ` Daniel de Rauglaudre

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='AANLkTi=tXmna=Rk5nyQbYWNambBYUUk1=nRS=aGC0cfV@mail.gmail.com' \
    --to=rathereasy@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=lukstafi@gmail.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