Browse thread
Writing Identity Functors (or Wrapper modules) in OCAML
-
Merijn de Jonge
-
Julien Signoles
-
Sebastian Egner
- Merijn de Jonge
-
Sebastian Egner
- Jean-Christophe Filliatre
-
Julien Signoles
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Merijn de Jonge <merijn.de.jonge@g...> |
| Subject: | Re: [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML |
Hi guys, Thank you all for the quick reply. I overlooked the paragraph "Re-exported variant type or record type: an equation, a representation." Adding the "type representation" did the trick. I needed a concrete type, so the solution to make it abstract is not appropriate in my case. Thanks agin. Merijn de Jonge On 2/27/06, Sebastian Egner <sebastian.egner@philips.com> wrote: > > > > > module type IHelloWorld = > > > sig > > > type helloWorldType = Hello | World > > > val hello : unit -> helloWorldType > > > end > > > > > > module Wrapper (X: IHelloWorld) : IHelloWorld = > > > struct > > > type helloWorldType = X.helloWorldType > > > let hello = X.hello > > > end > > > > You have to explicitely define Hello and World in the wrapper. Try this > : > > > > module Wrapper(X:IHelloWorld): IHelloWorld = > > struct > > type helloWorldType = X.helloWorldType = Hello | Word > > let hello = X.hello > > end > > Alternatively, you have defined too much In IHelloWorld > (depends on what you wanted to do in the first place). > Then try this: > > module type IHelloWorld = > sig > type helloWorldType (* now abstract *) > val hello : unit -> helloWorldType > end > > module Wrapper (X: IHelloWorld) : > (IHelloWorld with type helloWorldType = X.helloWorldType) = > struct > type helloWorldType = X.helloWorldType > let hello = X.hello > end > > ... > > Sebastian Egner.