Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question about type unification
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Romain Bardou <Romain.Bardou@l...>
Subject: Re: [Caml-list] Question about type unification
Richard Jones a écrit :
> 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.
> 
> Rich.
> 

My guess is that 'a t being just a type abbreviation, it is expanded to 
float when unifying. Private types are not type abbreviations, so they 
can't be expanded.

-- 
Romain Bardou