Browse thread
Question about type unification
[
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: | Jon Harrop <jon@f...> |
| Subject: | Re: [Caml-list] Question about type unification |
On Monday 26 May 2008 13:22:04 Richard Jones wrote: > With this definition: > > type 'a t = float > > Why is this allowed? > > # ((3.0 : unit t) : string t) ;; > - : string t = 3. > > Note that unification is prevented if t is opaque, eg, hidden behind a > module signature. Because your accessible definition allows you to replace 'a t with float for any 'a, which allows you to replace both of your types with float and, therefore, they must unify. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e