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
recursive modules?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-06-01 (00:13)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] recursive modules?
From: "L.G. Meredith" <>

> i'm mostly a neophyte with OCaml. Please find below a simple example of a
> code i would like to be able to write, but that the compiler will not eat. i
> build a term language over a set of variables that are themselves abstractly
> characterized in terms of some identifier type. i would like to write a
> recursive module in which the abstract type of identifier is essentially the
> type of the joinedcompositionfunctor applied to itself. One can show that
> this results in a (mathematically) well-founded definition. Is there a
> version of OCaml or an OCaml compiler option that will enable this kind of
> recursive definition?

RTFM :-) Recursive modules are in the "language extensions" chapter.

Here is what I believe should be your module (if I understood
correctly your intent.)

module rec VariableOfRJoinedComposition :
    (IDENTIFIER with type idType =
= struct

  module RJoinedCompositionEquivalence =
    Equivalence ( JoinedCompositionFunctor )( VariableOfRJoinedComposition )

  type idType = RJoinedCompositionEquivalence.JoinedComposition.composite
  let comparator =