caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: rossberg@mpi-sws.org
To: caml-list@inria.fr
Cc: dumitru.potop@inria.fr
Subject: Re: [Caml-list] Bug in the module system of version 3.12.0+beta1
Date: Wed, 21 Jul 2010 17:49:11 +0200 (CEST)	[thread overview]
Message-ID: <a64d440189769a62de3b6006ea28e687.squirrel@mail.mpi-sws.org> (raw)
In-Reply-To: <AANLkTikvjA641yGQJDFrC-wWOyLRGuudTh=gZjpKiHYj@mail.gmail.com>

"Jeremy Yallop" <yallop@gmail.com> wrote:
> 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.

Or just write a functor that returns a structure containing the desired
signature. This requires no new features:

  module Abc (M:Simple) =
    struct
      module type S =
        sig
          val x : M.t
        end
    end

Use it as follows:

  module MyModule :
    sig
      include Abc(IntSet).S
      val y : int
    end = ...

/Andreas


  reply	other threads:[~2010-07-21 15:49 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 ` [Caml-list] " Jeremy Yallop
2010-07-21 15:49   ` rossberg [this message]
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=a64d440189769a62de3b6006ea28e687.squirrel@mail.mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --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).