From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA05602; Fri, 4 Jun 2004 10:49:39 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA05613 for ; Fri, 4 Jun 2004 10:49:38 +0200 (MET DST) Received: from newext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i548ncSH014852 for ; Fri, 4 Jun 2004 10:49:38 +0200 Received: from serveur-mail.lri.fr (serveur-mail [129.175.8.90]) by newext.lri.fr (8.12.10/jtpda-5.4) with ESMTP id i548f8BG009515 ; Fri, 4 Jun 2004 10:41:08 +0200 (MEST) Received: from pc8-119.lri.fr (pc8-119 [129.175.8.119]) by serveur-mail.lri.fr (8.11.6p2/jtpda-5.3.2) with ESMTP id i548f7q06347 ; Fri, 4 Jun 2004 10:41:07 +0200 (MEST) Received: from localhost ([127.0.0.1]) by pc8-119.lri.fr with esmtp (Exim 3.36 #1 (Debian)) id 1BWAGB-0006Gb-00; Fri, 04 Jun 2004 10:41:07 +0200 Date: Fri, 4 Jun 2004 10:41:07 +0200 (MEST) From: Julien Signoles To: Damien cc: Caml List Subject: Re: [Caml-list] module types In-Reply-To: <20040603192619.2a50e1f5@mostha> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-Miltered: at concorde with ID 40C037A2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; signoles:01 signoles:01 lri:01 caml-list:01 struct:01 re-write:01 struct:01 lri:01 mcvoy:01 sig:01 sig:01 module:03 module:03 unit:03 unit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > module type T = sig type 'a t end > module F(M: T): sig > type a > type t = a M.t > (* plus a lot of values... *) > end = struct > type a = unit > type t = unit M.t > end > > I would like to re-write it like this : > > module type T = sig type 'a t end > module type O = > sig > type a > type t > (* plus a lot of values... *) > end > module F(M: T): O with type t = a M.t = > struct > type a = unit > type t = unit M.t > end > > but I can't, because "a" is unknown... > (of course, I want to keep it abstract) > > any idea ? I already encountered this problem a while ago. I solved it by using the following technic: module type T = sig type 'a t end module type O = sig type a type t end type b = unit module F(M:T): O with type t = b M.t and type a = b = struct type a = unit type t = unit M.t end In the signature of the above structure, [b] should be abstract in order to keep [a] abstract. Sadly, this technic introduces a new type definition but I don't see a better way to solve this problem. Hope this helps, Julien Signoles -- mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles "In theory, practice and theory are the same, but in practice they are different" (Larry McVoy) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners