As Jon demonstrates it is "possible," but I do not think it truly achieves what you are trying to do.  What is your use case?  I do not recommend trying to make types recursive across modules.  Even recursively defined modules have reared their ugly end on me.  It is equivalent to writing non-orthogonal code, in the functional paradigm (see Pragmatic Programmer).



On Mon, Jul 14, 2008 at 10:04 AM, Jon Harrop <jon@ffconsultancy.com> wrote:
On Monday 14 July 2008 17:50:02 Andre Nathan wrote:
> Hello
>
> Say I have the following type definition:
>
>   type a = { x: int; foo: b } and  b = { y: int; bar: a }
>
> Is it possible to define types a and b in their own files (thus in
> modules A and B) and still allow them to be mutually recursive?

Yes. See the OCaml Journal article "Tricks with recursion: knots, modules and
polymorphism" or Google for the phrase "untying the recursive knot".

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



--
-----------------------------------------------------------------------
(\__/)
(='.'=)This is Bunny. Copy and paste Bunny into your
(")_(")signature to help him gain world domination.
------------------------------------------------------------------------