From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 729D6BBAF for ; Thu, 20 May 2010 00:58:27 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIDAF8J9EvUGyoFlGdsb2JhbACdfxUBAQEBCQsICREDH749hRAE X-IronPort-AV: E=Sophos;i="4.53,265,1272837600"; d="scan'208";a="50908607" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 May 2010 00:58:26 +0200 Received: from smtp5-g21.free.fr (localhost [127.0.0.1]) by smtp5-g21.free.fr (Postfix) with ESMTP id 02CE1D4808E for ; Thu, 20 May 2010 00:58:21 +0200 (CEST) Received: from [192.168.0.3] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp5-g21.free.fr (Postfix) with ESMTP for ; Thu, 20 May 2010 00:58:20 +0200 (CEST) Message-ID: <4BF46D09.1000206@frisch.fr> Date: Thu, 20 May 2010 00:58:17 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100511 Shredder/3.0.6pre MIME-Version: 1.0 To: caml-list Subject: Re: [Caml-list] recursive module and types References: <4BF3D87D.6010805@univ-savoie.fr> In-Reply-To: <4BF3D87D.6010805@univ-savoie.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 recursive:01 christophe:01 raffalli:01 sig:01 val:01 struct:01 node:01 node:01 elt:01 sig:01 wrote:01 rec:01 caml-list:01 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