caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Yallop <yallop@gmail.com>
To: dumitru.potop@inria.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Bug in the module system of version 3.12.0+beta1
Date: Wed, 21 Jul 2010 15:13:28 +0100	[thread overview]
Message-ID: <AANLkTikvjA641yGQJDFrC-wWOyLRGuudTh=gZjpKiHYj@mail.gmail.com> (raw)
In-Reply-To: <4C46F866.9050900@inria.fr>

On 21 July 2010 14:38, Dumitru Potop-Butucaru
<dumitru.potop_butucaru@inria.fr> wrote:
> module type Abc =
>   functor (M:Simple) ->
>   sig
>      val x : M.t
>   end

You're trying to treat Abc as a functor from signatures to signatures
(i.e. as a parameterised signature).  In fact, it's something quite
different: it's the *type* of a functor from structures to structures.

You can emulate a parameterised signature using a signature with some
opaque components, which are later specified using substitution.
Here's the "parametrised signature":

  module type ABC =
  sig
    module M : Simple
    val x : M.t
  end

Here's how to supply a value for M:

  module MyModule :
  sig
     include ABC with module M = IntList
     val y : int
  end
= ...

In OCaml 3.12 you can use destructive substitution instead, ensuring
that M doesn't appear in the output signature.  Note the ':=' in the
line that includes ABC:

  module MyModule :
    sig
       include ABC with module M := IntList
       val y : int
    end
  = ...


  reply	other threads:[~2010-07-21 14:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 13:38 Dumitru Potop-Butucaru
2010-07-21 14:13 ` Jeremy Yallop [this message]
2010-07-21 15:49   ` [Caml-list] " rossberg
2010-07-21 18:41   ` Dumitru Potop-Butucaru
2010-07-22  2:29     ` Alain Frisch
2010-07-22  6:36       ` Dumitru Potop-Butucaru
2010-07-22  6:18     ` Jacques Garrigue
     [not found]       ` <4C47E768.4080507@inria.fr>
     [not found]         ` <9454F06C-C286-4A1F-8A9F-CA3B27F8E3BB@gmail.com>
2010-07-22  7:07           ` Dumitru Potop-Butucaru
2010-07-22  9:37       ` rossberg
2010-07-22 10:44         ` Jacques Garrigue
2010-07-22 12:28           ` Dumitru Potop-Butucaru

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='AANLkTikvjA641yGQJDFrC-wWOyLRGuudTh=gZjpKiHYj@mail.gmail.com' \
    --to=yallop@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=dumitru.potop@inria.fr \
    /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).