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
Unexpected '_a problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-08-04 (14:18)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] Unexpected '_a problem
On 8/3/06, Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> wrote:
> type 'a bar_t = Bar of <bar: ('a -> unit) -> unit> ;;
> let create_bar () = Bar (object method bar (_: 'a) = () end);;
> let b = create_bar ();;
> let Bar b = b;;

Okay, that got the types to work out correctly.

> If you still want to use Obj.magic, remember to put complete type
> annotions on both its input and output, as the lack of type
> information may break the compiler.

Surprisingly putting a type annotation on its output caused it to
infer a monomorphic type - I was relying on the type in the module's
signature since the type there is abstract.