From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q1LJbxU9022695 for ; Tue, 21 Feb 2012 20:37:59 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvABAHLxQ09KfVI0imdsb2JhbABDhluiUgGJDQgiAQEBCgkNBxIGI4FzAQEBAwESAiwBGx4DAQsGBQQHOyEBAREBBQEcBhMbB4demnQKi3KCcYVCP4hzAgULiHFYgnwFAQ8ChA0CHIMtBIhPjGmHF4QAgxY9hCGBNQk X-IronPort-AV: E=Sophos;i="4.73,459,1325458800"; d="scan'208";a="132337314" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 21 Feb 2012 20:37:53 +0100 Received: by wgbds10 with SMTP id ds10so6469410wgb.9 for ; Tue, 21 Feb 2012 11:37:53 -0800 (PST) Received-SPF: pass (google.com: domain of agarwal1975@gmail.com designates 10.216.137.230 as permitted sender) client-ip=10.216.137.230; Authentication-Results: mr.google.com; spf=pass (google.com: domain of agarwal1975@gmail.com designates 10.216.137.230 as permitted sender) smtp.mail=agarwal1975@gmail.com; dkim=pass header.i=agarwal1975@gmail.com Received: from mr.google.com ([10.216.137.230]) by 10.216.137.230 with SMTP id y80mr1156272wei.21.1329853073445 (num_hops = 1); Tue, 21 Feb 2012 11:37:53 -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 :content-type; bh=poS+gk05PlUu3YhV75iwkw9poSDf22vsT8W/Gh2Xmys=; b=RkxQS0l8/7Vnu1sf4i4RsZ2faZaqx0xperfF/gh08LRlW7cB6r2YpHYnJJrg7GkPtA CWGqUIbLF6QBJtV5lZyBtutZI7QMixCUUpDGcDKE9Yqjr2g2GNh6tMZQN1YEKlIkbMph V/8rHc2sOI8u931EEPUJIk4IwASN7ECrWHJn4= Received: by 10.216.137.230 with SMTP id y80mr958945wei.21.1329853071251; Tue, 21 Feb 2012 11:37:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.39.148 with HTTP; Tue, 21 Feb 2012 11:37:31 -0800 (PST) In-Reply-To: References: From: Ashish Agarwal Date: Tue, 21 Feb 2012 14:37:31 -0500 Message-ID: To: Caml List Content-Type: multipart/alternative; boundary=0016e6d62583ea596404b97e8bde Subject: [Caml-list] Re: "module type of" on sub-module of functor result --0016e6d62583ea596404b97e8bde Content-Type: text/plain; charset=ISO-8859-1 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. On Tue, Feb 21, 2012 at 1:16 PM, Ashish Agarwal wrote: > The following code compiles correctly: > > ----- a.ml ----- > open Batteries > module Ord = struct type t=string let compare=compare end > > module type S = sig > include module type of Map.Make(Ord) > (* include module type of Map.Make(Ord).Labels *) > end > ----- > > An easy workaround is to name the functor's result: > > ----- a.ml ----- > open Batteries > module Ord = struct type t=string let compare=compare end > > module M = Map.Make(Ord) > > module type S = sig > include module type of M > include module type of M.Labels > end > ----- > > The above compiles correctly, but is this the best/only solution? > > --0016e6d62583ea596404b97e8bde Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I must've accidentally deleted part of my email before hitting send. Th= e point was to make the first code sample compile after removing the commen= ted line. But that is not allowed; I get a syntax error:

$ ocamlfind ocamlc -c -package batteries a.ml<= /a>=A0
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.


On Tue, Feb 21, 2012 at 1:16 = PM, Ashish Agarwal <agarwal1975@gmail.com> wrote:
The following code compiles correctly:

----- = a.ml -----
open Bat= teries
module Ord =3D struct type t=3Dstring let compare=3Dcompar= e end=A0

module type S =3D sig
=A0 include module type of Map.Make(Or= d)
=A0 (* include module type of Map.Make(Ord).Labels *)
end
-----

An easy workaround is to nam= e the functor's result:

----- a.= ml -----
open Batteries
module Ord =3D struct type = t=3Dstring let compare=3Dcompare end=A0

module M = =3D Map.Make(Ord)

module type S =3D sig
=A0 include module type of M=
=A0 include module type of M.Labels
end
-----

The above compiles correctly, but is this = the best/only solution?


--0016e6d62583ea596404b97e8bde--