Browse thread
[Caml-list] Multiparameter functors?
-
Brian Hurt
- Julien Signoles
- Matt Gushee
- Julien Demouth
[
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: | 2003-12-22 (23:44) |
From: | Julien Demouth <julien.demouth@f...> |
Subject: | Re: [Caml-list] Multiparameter functors? |
Hi, Brian Hurt wrote: > Is it possible to do multi-parameter functors? What I want to be able to > so is something like: > > module Make(Key: Map.OrderedType, Pri: Map.OrderedType) = struct > type key = Key.t;; > type pri = Pri.t;; > ... > end;; Of course it's possible but you mustn't use the comma. A functor is just a function. The only difference is that it deals with structure whereas "normal" functions deal with values. Consider the following example: module type M = sig type t end module type N = sig type t end module type R = sig type u and v end module Make (U:M) (V:N) : R with type u = U.t and type v = V.t > Am I being stupid and just missing something obvious, or is there some > subtle reason why I shouldn't be doing this? Every question is good to be asked ;) Regards, Julien ------------------- 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