English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Bug in the module system of version 3.12.0+beta1
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-07-21 (15:49)
From: rossberg@m...
Subject: Re: [Caml-list] Bug in the module system of version 3.12.0+beta1
"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) =
      module type S =
          val x : M.t

Use it as follows:

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