From: Andreas Rossberg <rossberg@mpi-sws.org>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: "module type of" on sub-module of functor result
Date: Wed, 22 Feb 2012 19:49:01 +0100 [thread overview]
Message-ID: <5C609F89-8739-4280-A6D9-3F78C451E0C1@mpi-sws.org> (raw)
In-Reply-To: <CAPFanBFEjhg5BF-0aiAnXAQM7zAAQWLTAw0kMfvMKHX8R=eU0A@mail.gmail.com>
On Feb 22, 2012, at 18.24 h, Gabriel Scherer wrote:
>> [A(B)] and [A.B] are syntacticly valid module_expr's but
>> [A(B).C] isn't. Is this because of an inherent limitation in the
>> module system?
>
> I believe so. When you apply a functor, you may get fresh types as a
> result -- the generative (abstract, algebraic) types of the functor
> image. If you write `module M = A(B)`, the fresh types have a clear
> identity: M.t, M.q etc; similarly if you pass A(B) to a functor with
> formal parameter X, it is X.t, X.q etc. But if you write `module M =
> A(B).C`, there is no syntactic way to name the fresh types generated
> by the functor application; in particular, naming them A(B).t would be
> incorrect -- because you could mix types of different applications.
>
> For example, what would be the signature of A(B).C with:
>
> module B = struct end
> module A(X : sig end) = struct
> type t
> module C = struct type q = t end
> end
>
> ?
Are you perhaps thinking of SML-style generative functors here?
Because with Ocaml's applicative functors F(A) in fact always returns
the same abstract types, and you _can_ actually refer to types via the
notation F(A).t ;-)
/Andreas
next prev parent reply other threads:[~2012-02-22 18:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 18:16 [Caml-list] " Ashish Agarwal
2012-02-21 19:37 ` [Caml-list] " Ashish Agarwal
2012-02-21 20:32 ` Hezekiah M. Carty
2012-02-22 16:18 ` Milan Stanojević
2012-02-22 16:40 ` Till Varoquaux
2012-02-22 17:24 ` Gabriel Scherer
2012-02-22 18:49 ` Andreas Rossberg [this message]
2012-02-22 23:17 ` Jacques Garrigue
2012-02-23 10:05 ` Gabriel Scherer
2012-02-23 14:30 ` Ashish Agarwal
2012-02-22 17:35 ` Ashish Agarwal
2012-02-22 17:48 ` Gabriel Scherer
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=5C609F89-8739-4280-A6D9-3F78C451E0C1@mpi-sws.org \
--to=rossberg@mpi-sws.org \
--cc=caml-list@inria.fr \
--cc=gabriel.scherer@gmail.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