Version française
Home     About     Download     Resources     Contact us    
Browse thread
polymorphic variants and promotion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] polymorphic variants and promotion
From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
> Keiko Nakata a écrit :
> > indeed we need to use double coercion, instead of single:
> >
> > # ((`A 1 : [ `A of int ]) : [ `A of int ] :> [> `A of int ]);;
> > - : [> `A of int ] = `A 1
> > # ((`A 1 : [ `A of int ]) :> [> `A of int ]);;
> > - : [ `A of int ] = `A 1
> >
> >   
> To me this looks like a bug ? Should not we always have that "e :> t" 
> has type "t" (if it typechecks) ?

No, it should have type "an instance of t", like for all type
annotations in ocaml. And [`A of int] happens to be an instance of
[> `A of int].

Jacques Garrigue