Version française
Home     About     Download     Resources     Contact us    
Browse thread
GADT constructor syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Le Normand <rathereasy@g...>
Subject: Re: [Caml-list] GADT constructor syntax
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.

On Sat, Dec 4, 2010 at 3:22 PM, Lukasz Stafiniak <lukstafi@gmail.com> wrote:
> On Sat, Dec 4, 2010 at 9:14 PM, Jacques Le Normand <rathereasy@gmail.com> wrote:
>>
>> having
>>
>> type 'a t = Foo of 'a : 'b t
>>
>> creating a constructor of type forall 'a. 'a -> 'a t is really
>> confusing since the user explicitly gave the return type of the
>> constructor as 'b t.
>
> But why would the user have named 'a in the first place then. In the
> context of Foo, it should be assumed that
>
> 'a t = 'b t
>