Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Multiparameter functors?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matt Gushee <mgushee@h...>
Subject: Re: [Caml-list] Multiparameter functors?
On Sun, Dec 21, 2003 at 07:30:27PM -0500, 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;;
> 
> Am I being stupid and just missing something obvious,

Is there anything obvious about functors? ;-)

I've found the following syntax to work:

  module Make =
    functor (Key:Map.OrderedType) -> functor (Pri:Map.OrderedType) ->
      struct
        ....
      end;;

... though I'm not qualified to comment on the merits of doing or not
doing this.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

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