caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bob zhang <bobzhang1988@gmail.com>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] First Class modules -A bug in 4.00?
Date: Fri, 8 Jun 2012 11:25:14 -0400	[thread overview]
Message-ID: <CANcqPu5ytG7jriBrujbjqzA5BkFBNXKxbWf+A8-t40EtONEY5Q@mail.gmail.com> (raw)
In-Reply-To: <8D5E880B-79AC-45E1-B866-B83C3D725E36@math.nagoya-u.ac.jp>

[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2254 bytes --]

  reply	other threads:[~2012-06-08 15:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08  2:35 Hongbo Zhang
2012-06-08  3:22 ` Jacques Garrigue
2012-06-08 15:25   ` bob zhang [this message]
2012-06-08 15:29     ` bob zhang
2012-06-08 20:25   ` Milan Stanojević
2012-06-10  9:27     ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANcqPu5ytG7jriBrujbjqzA5BkFBNXKxbWf+A8-t40EtONEY5Q@mail.gmail.com \
    --to=bobzhang1988@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).