Version française
Home     About     Download     Resources     Contact us    
Browse thread
Cannot safely evaluate the definition of the recursively-defined module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hugo Ferreira <hmf@i...>
Subject: Re: [Caml-list] Cannot safely evaluate the definition of the recursively-defined module
Julien SIGNOLES wrote:
> Hello,
> 
>> module rec A1 : AA with type q = ASet.t
>>                     with type t = string
>>                   = struct
>>                       type q = ASet.t
>>                       type t = string
>>
>>                       let compare s1 s2 = Pervasives.compare s1 s2
>>                       let add e s = ASet.add e s
>>                       let empty = ASet.empty
>>                     end
>>          and ASet : Set.S with type elt = A1.t
>>                   = Set.Make(A1)
>>
>> No. It doens't work.
> 
>>>     however I am getting the following error:
>>>
>>>     Cannot safely evaluate the definition of the recursively-defined module
>>>     (refers to "AA.empty" when implemented as a constant value)
> 
> That is consistent with the behaviour specified in Section 7.8 of the
> reference manual [1]. Both A1 and ASet are not safe according to the
> definition given in this section. So a type error occurs because ocaml
> does know that the program won't be safely evaluated.
> 
> For additional details, you could refer to the Xavier Leroy's notes
> describing the implementation of recursive modules in ocaml [2].
> 
> [1] http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc75
> [2] http://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf
> 

Read the manual.
I'll take a look at [2]

Thank you.
Hugo F.


> Hope this helps,
> Julien Signoles