Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Module/functor question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: [Caml-list] Module/functor question
From: ronniec95@lineone.net
Subject: [Caml-list] Module/functor question
Date: Sun, 14 Mar 2004 19:05:28 +0000

> but I cannot figure out how to declare Foo having a signature of
> Serialiser and then use it in main somehow. Assume also that I have
> lots of other modules which have same basic interface but additional
> methods specific to the modules.

You do not need to declare.  Foo.Make will accept any module whose
signature is an *extension* of Serializer.

> (* was hoping for something like this *)
> let _ = let m = module Sender(Foo.Make) in
> 	m.serialisetoxml (Foo.Make (Xml.parse_from "..."));

By the way, a correct code would be

   let _ =
      let module M = Sender(Foo.Make) in
      M.serialisetoxml (Foo.Make (Xml.parse_from "..."));

--
Yamagata Yoriyuki

-------------------
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