From: "John F. Carr" <jfc@mit.edu>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: OCaml mailing-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Locally abstract type with type parameters
Date: Wed, 20 Aug 2014 21:19:28 -0400 [thread overview]
Message-ID: <21493.18720.441084.32472@gargle.gargle.HOWL> (raw)
In-Reply-To: <1408559896.43780.YahooMailNeo@web121705.mail.ne1.yahoo.com>
I hit the same limitation last year:
https://sympa.inria.fr/sympa/arc/caml-list/2013-04/msg00159.html
The inability to constrain parameterized types in packed module
types is a documented restriction. You will have to ask the type
theory experts whether it is a necessary restriction.
A followup message offered a workaround for some cases.
https://sympa.inria.fr/sympa/arc/caml-list/2013-04/msg00160.html
> To avoid type-escaping-its-scope errors, we need to define a locally abstract
> type in the implementation of 'actually_process'. Something like this:
>
> let actually_process (type u) (module Logger: LOGGER with type 'a Monad.t = 'a u) x =
> let open Logger in
> let (>>=) t f = Monad.bind t f in
> Logger.log () >>= fun () ->
> Monad.return x
>
>
> Which does not actually compile. Is it at all possible to use a locally
> abstract type when that type has type parameters? And is there a solution
> to this problem that does not require a) moving the implementation of
> 'actually_process' to the inside of a functor, or b) pass each function
> of the first-class module as a separate parameter to 'actually_process'?
>
> Thanks in advance for your time!
> Best regards,
> Dario Teixeira
next prev parent reply other threads:[~2014-08-21 1:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 18:38 Dario Teixeira
2014-08-21 1:19 ` John F. Carr [this message]
2014-08-22 2:23 ` Benjamin Greenman
2014-08-24 16:39 ` Leo White
2014-08-26 14:33 ` Dario Teixeira
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=21493.18720.441084.32472@gargle.gargle.HOWL \
--to=jfc@mit.edu \
--cc=caml-list@inria.fr \
--cc=darioteixeira@yahoo.com \
/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