Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type issue
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Type issue
Zitat von Andrej Bauer <Andrej.Bauer@fmf.uni-lj.si>:

> Here's a simpler example:
>
> # fun (g, x) -> (g true, g x) ;;
> - : (bool -> 'a) * bool -> 'a * 'a = <fun>
>
> Even though it looks like g could be of type 'b -> 'a, ocaml decides to
> go with bool only. I see this on the mailing list every once in a while,
> but I always forget the reasoning behind it.
[...]

g true  ===>  g is a function applied to a bool; result-type unspecified.

g x     ===> x is a bool, because g is a function that takes a bool-arg;
             g is explained above.

So, with the application "g true"
you already have fixed the type!

Jonathan's problem is very similar.

Ciao,
   Oliver