Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Functorizing large collections of modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] Functorizing large collections of modules
"Yaron M. Minsky" <yminsky@cs.cornell.edu> writes:

> This seems messy and kind of silly.  Conceptually what I want is a
> single structure like this:
> 
> module Library(ZZp:ZZpSig) = 
> struct
> 
>   module Foo = 
>   struct ... end
> 
>   module Bar =
>   struct ... end
>   
>   ...
> 
> end
> 
> That way, all the interior modules (Foo, Bar) get to reference the same
> ZZp, without having to functorize the individual modules.  So, what I'd
> like is to be able to do this without sticking the modules Foo and Bar
> into the same single large unmanageable file.

you can call the functor in a bigger functor :

file foo.ml

module Make(ZZp:ZZpSig) =
struct ... end

file bar.ml

module Make(ZZp:ZZpSig) =
struct ... end

file library.ml

module Make(ZZp:ZZpSig)=
struct
  module Foo = Foo.Make(ZZp)
  module Bar = Bar.Make(ZZp)
end
-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners