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=1.9 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 586D9BC37 for ; Tue, 26 May 2009 14:37:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8BAP9/G0qEqOABmWdsb2JhbACXbgEBAQEBCAsKBxG1PIQLBQ X-IronPort-AV: E=Sophos;i="4.41,251,1241388000"; d="scan'208";a="29961812" Received: from oxalide-out.extra.cea.fr ([132.168.224.1]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 May 2009 14:37:20 +0200 Received: from pisaure.intra.cea.fr (pisaure.intra.cea.fr [132.166.88.21]) by oxalide.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-2.0) with ESMTP id n4QCZ5Fn020600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 26 May 2009 14:35:05 +0200 Received: from muguet1.intra.cea.fr (muguet1.intra.cea.fr [132.166.192.6]) by pisaure.intra.cea.fr (8.14.2/8.14.2) with ESMTP id n4QCbJDb004952; Tue, 26 May 2009 14:37:19 +0200 (envelope-from Julien.Signoles@cea.fr) Received: from [132.166.132.51] (is010215.intra.cea.fr [132.166.132.51]) by muguet1.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.1) with ESMTP id n4QCbIrZ026118; Tue, 26 May 2009 14:37:19 +0200 Message-ID: <4A1BE27E.8030908@cea.fr> Date: Tue, 26 May 2009 14:37:18 +0200 From: Julien Signoles User-Agent: Thunderbird 2.0.0.21 (X11/20090409) MIME-Version: 1.0 To: Pietro Abate , caml list Subject: Re: [Caml-list] small typing problem with modules ... References: <20090526093727.GA28741@uranium.pps.jussieu.fr> In-Reply-To: <20090526093727.GA28741@uranium.pps.jussieu.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; signoles:01 signoles:01 functor:01 mli:01 mli:01 sig:01 functor:01 parametrized:01 sig:01 val:01 parametrize:01 val:01 ideally:01 abstract:01 typing:01 Hello, > My problem here is that I'd like to have a module type T for the functor > Make in b.ml and to avoid the signature duplication in b.mli ... ideally > I'd like to write in b.mli something like : > > module type T = sig ???? end > module Make : functor (Extra : A.Extra) -> > functor (A : A.T with type extra = Extra.t) -> T with ... > include T with ... > > It's clear that I cannot write a module type as follows because the > the "open A" will consider the default type of A and not it's > parametrized version ... > > module type T = sig > open A > val f : extra -> unit > end > > how can I parametrize this signature ? I can write something like : > module type T = functor (A : A.T) -> > sig > open A > val f : extra -> unit > end ;; > > 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 : ===== 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? ===== 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 ===== Hope this helps, Julien Signoles