Version française
Home     About     Download     Resources     Contact us    
Browse thread
module type...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Virgile Prevosto <virgile.prevosto@m...>
Subject: Re: [Caml-list] module type...
Hello,
Le 11.11.2004, à 20:09:31, Pietro Abate a écrit:
> 
> below the extended version of the problem with the same error...
> 
> any advice on how to modify my modules/classes design to overcome this
> problem ? what I'm trying to do is to have set, setofset,
> setofsetofset etc using the same code base and functors...
> 

You can use a variant of the solution (a), with t still being abstract
in ElType and the use of explicit type equalities (see the reference
manual,<http://pauillac.inria.fr/ocaml/htmlman/manual004.html>, section
2.4) for each of the implementations:

> module type ElType  =
>     sig
>         type t (* type t is abstract here. *)
>         val copy : t -> t
>         val to_string : t -> string
>     end

> module TermType : ElType 

                      with type t = int 
                      (* TermType.t is unifiable with int *)
  ... 
> module SetOfTerm = MakeSet (TermType) (Set.Make);;
> 
> module SetOfTermType : ElType 

                      with type t = SetOfTerm.set
                      (* SetOfTermType.t is unifiable with
                         Set.OfTerm.set *)
  ...
-- 
E tutto per oggi, a la prossima volta
Virgile