Version française
Home     About     Download     Resources     Contact us    
Browse thread
module types and constraints in several layers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Sternagel <christian.sternagel@u...>
Subject: module types and constraints in several layers
Hello all together, I have a problem using type constraints. There
are several module types in my sourcecode. Lets say

file A.mli --------
module type T = sig ...  end
-------------------

file B.mli --------
module type T = sig 
 ...
 module B1
 ... 
end
-------------------

file C.mli --------
module type T = sig ... end
-------------------

file D.mli --------
module type T = sig 
 ...
 moulde D1
 module D2
 module D3
 ...
end
-------------------

and then a couple of functors. Like

file b.ml ---------
module Make (A : A.T) : B.T = struct
 ...
 module B1 = A
 ...
end
-------------------

file d.ml ---------
module Make (B : B.T) (C : C.T) : D.T = struct
 ...
 module D1 = B.B1
 module D2 = B
 module D3 = C
 ...
end
-------------------

file e.ml ---------
module Make (D : D.T) = struct
 ...
 module E1 = D.D1
 module E2 = D.D2
 module E3 = D.D3
 module E4 = D
 ...
end
-------------------

Then I build a module like

module B = B.Make (A)
module D = D.Make (B) (C)
module E = E.make (D)

and from this point on only want to use E (so I want to access the
functions of the other modules though the submodules of E).
E.g.: 
E.E1 instead of A
E.E2 instead of B
etc...

but I was not able to tell the compiler (correctly) that after
building module E ist should be the case that for example
E.E1 = D.D1 = B.B1 = A = E4.D.D1 = E4.D.D2.B1 = ...

Is there a convenient way to make such a structure of modules?
And if yes, how ist it done?

cheers

christian