From: Markus Mottl <markus.mottl@gmail.com>
To: John Carr <jfc@mit.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Unpacked module parameterized type escaping
Date: Thu, 18 Apr 2013 16:11:10 -0400 [thread overview]
Message-ID: <CAP_800rb=iwE5OyYfEXnG7dXih93wEPOJxM2RWxzKOfORkLi2A@mail.gmail.com> (raw)
In-Reply-To: <201304181712.r3IHCbSC023593@outgoing.mit.edu>
On Thu, Apr 18, 2013 at 1:12 PM, John Carr <jfc@mit.edu> wrote:
>
> I have a function of two arguments:
>
> 1. A packed module implementing Map.S.
>
> 2. A value of the module's Map.S.t.
>
> I can't find a way to prevent a "type constructor ... would escape its
> scope" error.
I think you may just want to wrap both the map module to be used and
the value on which its functions should operate in another first-class
module, e.g.:
module type Arg = sig
module M : Map.S with type key = int
val v : 'a M.t
end
Then you can write:
let is_empty (module Arg : Arg) = Arg.M.is_empty Arg.v
This admittedly doesn't look particularly elegant, but should solve the problem.
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
prev parent reply other threads:[~2013-04-18 20:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-18 17:12 John Carr
2013-04-18 20:11 ` Markus Mottl [this message]
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='CAP_800rb=iwE5OyYfEXnG7dXih93wEPOJxM2RWxzKOfORkLi2A@mail.gmail.com' \
--to=markus.mottl@gmail.com \
--cc=caml-list@inria.fr \
--cc=jfc@mit.edu \
/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).