Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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) =
    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