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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stéphane Glondu <steph@g...>
Subject: Re: [Caml-list] Recursive subtyping issue
Guillaume Yziquel a écrit :
>> # type untyped;;
>> type untyped
>> # type 'a typed = private untyped;;
>> type 'a typed = private untyped
>> # type -'typing tau = private obj
>>   and 'a t = 'a typed tau
>>   and obj = private untyped tau;;
>> type 'a tau = private obj
>> and 'a t = 'a typed tau
>> and obj = private untyped tau
>> # let f : 'a t -> obj = fun x -> (x : 'a t :> obj);;
>> val f : 'a t -> obj = <fun>
>> # let g : obj -> 'a t = fun x -> (x : obj :> 'a t);;
>> val g : obj -> 'a t = <fun>
>> # 

Why don't you just declare 'a t to be synonym for obj in the
implementation of your module, declare them as abstract in its
interface, and export the specially typed identities f and g?


Cheers,

-- 
Stéphane