Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Mutually recursive types in different modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-07-14 (18:04)
From: Andre Nathan <andre@d...>
Subject: Re: [Caml-list] Mutually recursive types in different modules
On Mon, 2008-07-14 at 10:57 -0700, Arthur Chan wrote:
> 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).

I had a graph type that depended on a vertex type (Vertex.t), which in
its turn is a record with a graph field (of type Graph.t).

I parametrized the Graph.t type and then used it in the Vertex module as
"vertex Graph.t". I guess I have a better design now.