English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2007-11-23 (09:28)
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.