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: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] polymorphic variants and promotion
Hello,

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

This explains a little to me about the differences 
between double and single coercions.
Thanks. 

With best,
Keiko