Version française
Home     About     Download     Resources     Contact us    
Browse thread
Separating two mutually recursive modules (was Specifying recursive modules?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] Separating two mutually recursive modules
Hello,


> I have been unable to cleanly specify the code below (or something
> equivalent) without resorting to Obj.magic. (In the example below,
> "Boxes.B.t" as referenced by the Validator module would ideally simply
> be "Boxes.t", and Validator would not "see" the submodules;)

Can I look at the code which does not type check without Obj.magic?
Ideally something like if I comment out Obj.magic then I get a type error,
and if I comment it in then the code type checks, 
so that I can identify the point of the issue?
(In the context of this simplified example of Boxes & Validator)

>   (********************)
>   (* MODULE Validator *)
>   (********************)
> 
>   and Validator : sig
> 
>     (* This type has been simplified for explanatory purposes. *)
>     (* IDEALLY, Boxes.B.t would simply be B.t. *)
>     type t = Me of int | Node of t * t | B of Boxes.B.t
> 
>     val fold_on_B : (Boxes.B.t -> 'a) -> ('a -> 'a -> 'a) -> 'a -> t -> 'a
> 
>   end =

But B is not in the scope, isn't it?

With best,
Keiko