Browse thread
polymorphic variants and promotion
-
Johannes Kanig
-
Julien Signoles
-
Keiko Nakata
-
Christophe Raffalli
- Jacques Garrigue
-
Christophe Raffalli
-
Keiko Nakata
- Remi Vanicat
-
Julien Signoles
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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