Version française
Home     About     Download     Resources     Contact us    
Browse thread
a question about recursiv type defintions and functors like Set.Make?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] a question about recursiv type defintions and functors like Set.Make?
On Monday 21 May 2007 16:01:52 Phillip Heidegger wrote:
> I have a question about using the set functor.

This is a FAQ. From a post of mine (on 1st May 2007) on the OCaml beginners 
list:

Use mutually recursive modules:

# module rec Tree : sig
    type t = Content of int * TreeSet.t
    val compare : t -> t -> int
  end = struct
    type t = Content of int * TreeSet.t
    let compare = compare
  end
  and TreeSet : Set.S = Set.Make(Tree);;
sig type t = Content of int * TreeSet.t val compare : t -> t -> int end
and TreeSet : Set.S

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The F#.NET Journal
http://www.ffconsultancy.com/products/fsharp_journal/?e