From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 52640BC37 for ; Tue, 26 May 2009 15:12:25 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0BAE2HG0qGnQCBjmdsb2JhbACXbgEBAQEJCwgJDwW2AoQLBQ X-IronPort-AV: E=Sophos;i="4.41,251,1241388000"; d="scan'208";a="26803159" Received: from shiva.jussieu.fr ([134.157.0.129]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 May 2009 15:12:25 +0200 Received: from hydrogene.pps.jussieu.fr (hydrogene.pps.jussieu.fr [134.157.168.1]) by shiva.jussieu.fr (8.14.3/jtpda-5.4) with ESMTP id n4QDCO7J057876 for ; Tue, 26 May 2009 15:12:24 +0200 (CEST) X-Ids:166 Received: from hydrogene.pps.jussieu.fr (localhost.localdomain [127.0.0.1]) by hydrogene.pps.jussieu.fr (8.13.4/jtpda-5.4) with ESMTP id n4QDCNVc009210 for ; Tue, 26 May 2009 15:12:23 +0200 Received: (from abate@localhost) by hydrogene.pps.jussieu.fr (8.13.4/8.13.2/Submit) id n4QDCNrH009209 for caml-list@inria.fr; Tue, 26 May 2009 15:12:23 +0200 Date: Tue, 26 May 2009 15:12:23 +0200 From: Pietro Abate To: caml-list@inria.fr Subject: Re: [Caml-list] small typing problem with modules ... Message-ID: <20090526131223.GA7428@uranium.pps.jussieu.fr> References: <20090526093727.GA28741@uranium.pps.jussieu.fr> <4A1BE27E.8030908@cea.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A1BE27E.8030908@cea.fr> X-Operating-System: GNU/Linux User-Agent: Mutt/1.5.9i X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (shiva.jussieu.fr [134.157.0.166]); Tue, 26 May 2009 15:12:24 +0200 (CEST) X-Virus-Scanned: ClamAV 0.94.2/9393/Tue May 26 12:17:55 2009 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at jchkmail.jussieu.fr with ID 4A1BEAB8.003 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 4A1BEAB8.003/134.157.168.1/hydrogene.pps.jussieu.fr/hydrogene.pps.jussieu.fr/ X-j-chkmail-Score: MSGID : 4A1BEAB8.003 on jchkmail.jussieu.fr : j-chkmail score : . : R=. U=. O=. B=0.012 -> S=0.012 X-j-chkmail-Status: Ham X-Spam: no; 0.00; 0200,:01 signoles:01 functor:01 functor:01 sig:01 val:01 val:01 sig:01 mli:01 syntax:01 26,:98 2009:98 wrote:01 abstract:01 typing:01 On Tue, May 26, 2009 at 02:37:18PM +0200, Julien Signoles wrote: > >but then I'm a bit lost putting all this together ... > >I know I'm close ... a small hint ? > Hum, module types cannot be parameterized. If you want to use a functor > signature, you can write the following : uhmmm I was wondering ... :) > ===== > module type T = > functor (Extra : A.Extra) -> > functor (A : A.T with type extra = Extra.t) -> > sig val f : A.extra -> unit end > > module Make : T > > open A > val f : extra -> unit > ===== > > But I'm pretty sure that is not really what is expected... > However why cannot you just add an another abstract type in your > signature like below? well it does not solve the duplication problem as I cannot write something like : include T (A.ExtraDefault) (A) as we don't have functorized module types as you pointed out. you just moved the functor signature to the type T ... > ===== > module type T = sig > type extra > val f : extra -> unit > end > > module Make(Extra : A.Extra)(A : A.T with type extra = Extra.t) > : T with type extra = A.extra > > open A > val f : extra -> unit > ===== ok, I can do that, but it would be still annoying as the module A might contain a lot of types that I would need to add to the signature T in b.mli . Something like : module type T = sig type a type b ... type n val fa : a -> unit val fb : b -> unit ... val fn : n -> unit end but this should solve the duplication problem as I can now write something like include T with type extra = A.extra ( .... and all other types .... ) I'm still not really satisfied with this solution, but I'm now worried that with the current syntax is just not possible to solve my problem... thanks :) pp