[Caml-list] recursive module and types

2010-05-19 Thread Christophe Raffalli
Hello, I needed to define a (large) recursive type using sets basically as in the example below. What I do not like is that I need to repeat the definition of the type twice (in my real code the type is 100 lines long) ... Does anyone see a way to avoid it, apart from using parametric

Re: [Caml-list] recursive module and types

2010-05-19 Thread Alain Frisch
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