[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-05-19 (22:58) |
From: | Alain Frisch <alain@f...> |
Subject: | Re: [Caml-list] recursive module and types |
On 05/19/2010 02:24 PM, Christophe Raffalli wrote: > Does anyone see a way to avoid it I propose: module rec T : sig type t = U.t val compare : t -> t -> int end = struct include U let compare u v = match u, v with Leaf, Leaf -> 0 | Node u', Node v' -> S.compare u' v' | Leaf, Node _ -> -1 | Node _, Leaf -> 1 end and S : Set.S with type elt = T.t = Set.Make(T) and U : sig type t = Node of S.t | Leaf end = U The type definition is given only once. -- Alain