"Jeremy Yallop" <yal...@gmail.com> wrote:
> On 21 July 2010 14:38, Dumitru Potop-Butucaru
> <dumitru.potop_butuc...@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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to