Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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
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 Archives:
Bug reports: FAQ:
Beginner's list: