From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 20B5F7ED26 for ; Fri, 8 Jun 2012 17:25:19 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArgBAEUY0k/RVda0kGdsb2JhbABFDrQ6CCIBAQEBCQkNBxQEI4IYAQEBAwESAhMZARsdAQMBCwYFBAcNLiIBEQEFARwGEyKHWgEDBgWadgkDjCKCcIRvChknDVeIcQEFDIsahgADlR6OHj6DRlU X-IronPort-AV: E=Sophos;i="4.75,738,1330902000"; d="scan'208";a="147053005" Received: from mail-ob0-f180.google.com ([209.85.214.180]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Jun 2012 17:25:17 +0200 Received: by obbun3 with SMTP id un3so4233370obb.39 for ; Fri, 08 Jun 2012 08:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HYZqXYRS2kfJ1clMlBysKvNfaPZMZOE8/JwiqwUgIe0=; b=LrwWcCEHeP47k6Qi/Prd+XF4M10+3MXumYrTUfOU94s9/lZl00qW+CKo62RUarKF0T qOF5Y/U82c86SFb+WTgvDD7KW9X3/MNLA4DlQjW0JHFeiiYYbUkr+xL/uHev+nH+u4j/ 4tc0xGwkHK5TKTNRoJMBMUrtIXaAdNOcuIXPjpm7aiEPFNHpoh0HGPkTqhLR/XIppdCs 9LCSPasRhg3HL540m8WdlpFyhJwUbnSfgbP5Hhgwkc3HYzPUZ+2vRyf343uhhg/UBUtl y9R9TaCNQNPFDPdmCTFOaLp0x7MonbyMb+1gR4104ZsJ7ZLBmbE5vBaKjv4uu9/J28xO NfJA== MIME-Version: 1.0 Received: by 10.182.17.8 with SMTP id k8mr7102769obd.25.1339169114813; Fri, 08 Jun 2012 08:25:14 -0700 (PDT) Received: by 10.182.144.71 with HTTP; Fri, 8 Jun 2012 08:25:14 -0700 (PDT) In-Reply-To: <8D5E880B-79AC-45E1-B866-B83C3D725E36@math.nagoya-u.ac.jp> References: <4FD164E2.4050807@gmail.com> <8D5E880B-79AC-45E1-B866-B83C3D725E36@math.nagoya-u.ac.jp> Date: Fri, 8 Jun 2012 11:25:14 -0400 Message-ID: From: bob zhang To: Jacques Garrigue Cc: caml-list Content-Type: multipart/alternative; boundary=f46d044473f561f62204c1f79bd9 Subject: Re: [Caml-list] First Class modules -A bug in 4.00? --f46d044473f561f62204c1f79bd9 Content-Type: text/plain; charset=ISO-8859-1 Thanks. it helps. Here's what I really want, is there any way to walk around if not possible? S1 is not written by me. -------------------------------------------------------------------- module type S1 = sig module Inner : sig type 'a t val add : 'a t -> 'a t -> int end end let f1 (type s) (type a) (module Y : S1 with type s Inner.t = a) (y: s Y.Inner.t) = Y.Inner.add y y ------------------------------------------------------------------------------------------------------------ On Thu, Jun 7, 2012 at 11:22 PM, Jacques Garrigue < garrigue@math.nagoya-u.ac.jp> wrote: > On 2012/06/08, at 11:35, Hongbo Zhang wrote: > > > Hi, List > > I am not sure this is a bug or not? > > > > Below is a contrived example: > > ------------------ > > module type S = sig > > type t=int > > module X : sig type u end > > end > > > > let f ( module X : S) (y:X.X.u) = > > 3 > > -------------------- > > Error: This pattern matches values of type X.X.u > > but a pattern was expected which matches values of type X.X.u > > The type constructor X.X.u would escape its scope > > -- Thanks > > Definitely, this is not a bug. > Type X.X.u is abstract, and showing it outside (as by taking an argument > of that type) would be meaningless. > > What you might have meant is: > > let f (type a) (module X : S with type X.u = a) (y : X.X.u) = 3 > > This is typable (but I'm not sure it means anything...) > > Jacques Garrigue > -- -- Bob --f46d044473f561f62204c1f79bd9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks. it helps.
Here's what I really want, is there any way to wa= lk around if not possible?

S1 is not written by me= .
---------------------------------------------------------------= -----
module type S1 =3D sig
=A0 module Inner =A0: sig
= =A0 =A0 type 'a t
=A0 =A0 val add : 'a t -> 'a t -= > int=A0
=A0 end=A0
end=A0

= let f1
=A0 =A0 (type s)
=A0 =A0 (type a)
=A0 =A0 (module Y : S1 with type s Inner.t = =3D a) (y: s Y.Inner.t) =3D
=A0 Y.Inner.add y y=A0
----= ---------------------------------------------------------------------------= -----------------------------
On Thu, Jun 7, 2012 at 11:22 PM, Jacques Garrigu= e <garrigue@math.nagoya-u.ac.jp> wrote:
On 2012/06/08, at 11:35, Hongbo Zhang wrote:

> Hi, List
> =A0I am not sure this is a bug or not?
>
> =A0Below is a contrived example:
> ------------------
> =A0module type S =3D sig
> =A0 =A0type t=3Dint
> =A0 =A0module =A0X : sig type u =A0 end
> =A0end
>
> =A0let f ( module X : S) =A0(y:X.X.u) =3D
> =A03
> --------------------
> Error: This pattern matches values of type X.X.u
> =A0 =A0 =A0but a pattern was expected which matches values of type X.X= .u
> =A0 =A0 =A0The type constructor X.X.u would escape its scope
> -- Thanks

Definitely, this is not= a bug.
Type X.X.u is abstract, and showing it outside (as by taking an argument
of that type) would be meaningless.

What you might have meant is:

=A0let f (type a) (module X : S with type X.u =3D a) (y : X.X.u) =3D 3

This is typable (but I'm not sure it means anything...)

Jacques Garrigue



--
= -- Bob
--f46d044473f561f62204c1f79bd9--