Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-05-26 (19:43)
From: Robert Fischer <robert@f...>
Subject: Re: [Caml-list] Question about type unification
Ahh.  Yeah, I see it now -- the output wasn't a string, but a float.  It just has the word "string"
in the type name to confuse me.

~~ Robert.

DooMeeR wrote:
> Robert Fischer a écrit :
>> How is the compiler magically getting from the float to a string
>> value?  Can someone break down
>> what's actually happening here for me?
> It's not "getting to" a "string" value but to a "string t" value, which
> is an abbreviation for "float". The value has type "float", but the user
> requires type "string t", so the compiler unifies "float" and "string t"
> which is actually "float" so it's ok, and then the compiler gives the
> type requested by the user to the value, i.e., "string t".
> Well, at least, this is how I understand this :)