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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 1BEC0BC37 for ; Tue, 26 May 2009 11:37:30 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUCAFdVG0qGnQCBfWdsb2JhbACXbQEBCwsIBxEFtFqECwU X-IronPort-AV: E=Sophos;i="4.41,250,1241388000"; d="scan'208";a="40553829" Received: from shiva.jussieu.fr ([134.157.0.129]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 May 2009 11:37:29 +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 n4Q9bSd1005504 for ; Tue, 26 May 2009 11:37:29 +0200 (CEST) X-Ids:168 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 n4Q9bREE029887 for ; Tue, 26 May 2009 11:37:27 +0200 Received: (from abate@localhost) by hydrogene.pps.jussieu.fr (8.13.4/8.13.2/Submit) id n4Q9bReR029886 for caml-list@inria.fr; Tue, 26 May 2009 11:37:27 +0200 Date: Tue, 26 May 2009 11:37:27 +0200 From: Pietro Abate To: caml-list@inria.fr Subject: small typing problem with modules ... Message-ID: <20090526093727.GA28741@uranium.pps.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: GNU/Linux User-Agent: Mutt/1.5.9i X-Virus-Scanned: ClamAV 0.94.2/9223/Fri Apr 10 16:54:59 2009 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at jchkmail.jussieu.fr with ID 4A1BB858.008 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 4A1BB858.008/134.157.168.1/hydrogene.pps.jussieu.fr/hydrogene.pps.jussieu.fr/ X-j-chkmail-Score: MSGID : 4A1BB858.008 on jchkmail.jussieu.fr : j-chkmail score : . : R=. U=. O=. B=0.017 -> S=0.017 X-j-chkmail-Status: Ham X-Spam: no; 0.00; sig:01 val:01 sig:01 val:01 struct:01 struct:01 mli:01 functor:01 mli:01 functor:01 parametrized:01 parametrize:01 ideally:01 typing:01 pps:01 Hi all, I'm trying to build a functorized version of a library providing also a default type. Consider the two follwoing modules : ~$cat a.ml module type T = sig type extra val f : extra -> unit end module type Extra = sig type t = private [> ] val g : t -> unit end module Make (Extra : Extra) = struct type extra = Extra.t let f t = () end module ExtraDefault = struct type t = [`A] let g t = () end include Make(ExtraDefault) ~$cat a.mli module type T = sig type extra val f : extra -> unit end module type Extra = sig type t = private [> ] val g : t -> unit end module ExtraDefault : Extra with type t = [ `A ] module Make : functor (Extra : Extra) -> T with type extra = Extra.t include T with type extra = ExtraDefault.t ------------------ so far so good. Now I've another module that I can type as follows: ~$cat b.ml module Make (Extra : A.Extra) (A : A.T with type extra = Extra.t) = struct open A let f t = () end include Make(A.ExtraDefault)(A) ~$cat b.mli module Make : functor (Extra : A.Extra) -> functor (A : A.T with type extra = Extra.t) -> sig open A val f : extra -> unit end open A val f : extra -> unit ------------------------ 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 ? TA. p