From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q1MHnFCH011094 for ; Wed, 22 Feb 2012 18:49:15 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmsCADspRU9KfVI0imdsb2JhbABDhSibZ5EuCCIBAQEKCQ0ZBiOBcwEBAQQSAg8dARsSCwEDDAYFCw0CAgkdAgIhAQERAQUBChIGExIJB4domk4KiyZMgnGFLj+IcwIFC4Ekh1BYgwACAQUDAQkXDwQFCgMDBwMCBQoGDwqFFkoGBQsKCAMEgheBFgSVOIcXhACDFj2EBIFSCQ X-IronPort-AV: E=Sophos;i="4.73,465,1325458800"; d="scan'208";a="145485728" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Feb 2012 18:49:10 +0100 Received: by wgbds10 with SMTP id ds10so306558wgb.9 for ; Wed, 22 Feb 2012 09:49:10 -0800 (PST) Received-SPF: pass (google.com: domain of gabriel.scherer@gmail.com designates 10.180.85.105 as permitted sender) client-ip=10.180.85.105; Authentication-Results: mr.google.com; spf=pass (google.com: domain of gabriel.scherer@gmail.com designates 10.180.85.105 as permitted sender) smtp.mail=gabriel.scherer@gmail.com; dkim=pass header.i=gabriel.scherer@gmail.com Received: from mr.google.com ([10.180.85.105]) by 10.180.85.105 with SMTP id g9mr38812560wiz.12.1329932950273 (num_hops = 1); Wed, 22 Feb 2012 09:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Hv/9O/xq1Egno6hfqJAzi/nJTb/akP1Xr9VLbIklWb0=; b=wpuac5AAtelGAUdFGsd0dcNuST6Wu+nCs92LTV9A9Q+AHOGuKc9l8wvJHIxPKDy2LB NWEiO/o0atG0sQCWBlqNlS7bGJDthB8bde0YNTVnzRgPI0hXoAu3grN4j/S53NK0S4u8 N2DQf6FcSln80EXb+j5/t7sEH6waSOME3C81U= Received: by 10.180.85.105 with SMTP id g9mr32232616wiz.12.1329932950179; Wed, 22 Feb 2012 09:49:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.63.13 with HTTP; Wed, 22 Feb 2012 09:48:30 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Wed, 22 Feb 2012 18:48:30 +0100 Message-ID: To: Ashish Agarwal Cc: Till Varoquaux , =?ISO-8859-2?Q?Milan_Stanojevi=E6?= , "Hezekiah M. Carty" , Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q1MHnFCH011094 Subject: Re: [Caml-list] Re: "module type of" on sub-module of functor result You could use the following work-around, which introduces an additional layer to have some space to name the functor application: module Map = struct module Make (Ord : BatInterfaces.OrderedType) = struct module M = BatMap.Make(Ord) module Result : module type of M.Labels = struct include M.Labels end end end I suppose that may not suit your need -- you probably want to mimic an existing hierarchy without changing it -- but it's difficult to do better with such a reduced example, where you don't even need the signature anyway. 2012/2/22 Ashish Agarwal : > Here's an example I still don't know how to accomplish: > > module Map = struct >   module Make (Ord : BatInterfaces.OrderedType) : sig >     include module type of BatMap.Make(Ord).Labels (* this line is invalid > *) >   end = struct >     include BatMap.Make(Ord) >     include Labels >   end > end > > The idea is I only want "module type of Labels" for the functor's output, > but I need BatMap.Make(Ord) within the implementation (perhaps to implement > some other functions). > > I thought I can simply replace the line "include BatMap.Make(Ord)" with > "open BatMap.Make(Ord)", and then not provide the explicit signature. But > "open BatMap.Make(Ord)" gives a syntax error. > > > 2012/2/22 Till Varoquaux >> >> 2012/2/22 Milan Stanojević d >> > On Tue, Feb 21, 2012 at 3:32 PM, Hezekiah M. Carty wrote: >> >> On Tue, Feb 21, 2012 at 2:37 PM, Ashish Agarwal >> >> wrote: >> >>> I must've accidentally deleted part of my email before hitting send. >> >>> The >> >>> point was to make the first code sample compile after removing the >> >>> commented >> >>> line. But that is not allowed; I get a syntax error: >> >>> >> >>> $ ocamlfind ocamlc -c -package batteries a.ml >> >>> File "a.ml", line 6, characters 38-39: >> >>> Error: Syntax error: 'end' expected >> >>> File "a.ml", line 4, characters 16-19: >> >>> Error: This 'sig' might be unmatched >> >>> >> >>> I'm wondering if there is a better solution than my second code >> >>> sample. >> >>> >> > >> > I would consider this a bug. I think than any module expression than >> > can be used with "include" should be usable with "include module type >> > of" >> > >> > -- >> > Caml-list mailing list.  Subscription management and archives: >> > https://sympa-roc.inria.fr/wws/info/caml-list >> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> > Bug reports: http://caml.inria.fr/bin/caml-bugs >> > >> >> Milan is right: the language grammar does say that both [include] and >> [module type of] should work on module_expr. However, based upon the >> manual(*),  [A(B)] and  [A.B] are syntacticly valid module_expr's but >> [A(B).C] isn't. Is this because of an inherent limitation in the >> module system? >> >> [*]http://caml.inria.fr/pub/docs/manual-ocaml/manual019.html#module-expr > >