caml-list  

Re: [Caml-list] A functor to produce recursive modules ?

Fabrice Marchant
Fri, 23 May 2008 16:30:56 -0700

On Fri, 23 May 2008 23:25:14 +0100
Jeremy Yallop <[EMAIL PROTECTED]> wrote:

> Fabrice Marchant wrote:
> > However, even if the method is clear, I run into problems trying to
> > apply it on these 2 recursive modules : map to sets and a set of map
> > to sets.
> 
> This doesn't appear to require recursive modules, since ModSet is not
> used within Mod.  Except for the missing "compare" (in your version),
> it's equivalent to the following:
> 
> module F ( X : Set.OrderedType ) = struct
>    module Mod : sig
>      module XSet :
>      sig
>        type elt = X.t
>        type t = Set.Make( X ).t
>      end
> 
>      module XMap :
>      sig
>        type key = X.t
>        type 'a t = 'a Map.Make( X ).t
>      end
> 
>      type elt = X.t
>      type t = XSet.t XMap.t
>      val compare : t -> t -> int
>    end =
>    struct
>      module XSet = Set.Make( X )
>      module XMap = Map.Make( X )
> 
>      type elt = X.t
>      type t = XSet.t XMap.t
>      let compare = XMap.compare XSet.compare
>    end
>    module ModSet : Set.S with type elt = Mod.t = Set.Make( Mod )
> end
 
> > Got this internal message from ocaml 3.10.1 : "Fatal error: exception
> > Assert_failure("typing/path.ml", 48, 22)"
> 
> I agree with Till that you should report this bug.
> 
> Jeremy.
> 
 
  Hi !

  You're right. But about the lack of "compare" and use of ModSet within Mod :
I just ditched the code that was unnecessary to exhibit the naughty message.

Regards,

Fabrice

_______________________________________________
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