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
any types in signatures of functor arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Virgile Prevosto <virgile.prevosto@m...>
Subject: Re: [Caml-list] any types in signatures of functor arguments
Le mar 25 oct 2005 11:22:20 CEST, Keiko Nakata <> a ecrit:

> So it seems that I cannot avoid modifying modules to which F is
> applied. Actually, I already written several modules, say M and N, in
> separate files. Later, I defined the functor F so as to apply it to
> the modules M and N. I thought that it would be nice if I can avoid
> modifying the implementations and interface files of M and N,
> since it will affect other parts of my program.

It might be possible to only modify the arguments you give to F, with
the use of include:

module M = struct let f (`A x) = x end

module F(X:sig type s type t = [ `A of s] val f: t -> int end) =
  struct let f = function `A _ as a -> X.f a | `B -> 0

module FM = F(struct include M type s = int type t = [ `A of s ])

E tutto per oggi, a la prossima volta