Version française
Home     About     Download     Resources     Contact us    
Browse thread
How can I set a type parameter of Map.Make(X) ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ashish Agarwal <agarwal1975@g...>
Subject: Re: [Caml-list] How can I set a type parameter of Map.Make(X) ?
module M = Map.Make(String)

type t = int M.t

Type t is the type of maps from string's to int's. Or alternatively write a
function that assumes 'a is some specific type:

# let f m = M.fold (fun _ x y -> x + y) m 0;;
val f : int M.t -> int = <fun>


On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru <
dumitru.potop_butucaru@inria.fr> wrote:

>
> Hello,
>
> I'm certain most users here will consider the question trivially simple,
> but I browsed the documentation without finding a solution.
>
> The question is quite general: Given a polymorphic definition like
> Map.Make(X), where
> X is some module, how can I specialize its 'a type parameter, e.g. by
> setting it to Y, so that
> I have maps from X to Y ?
>
> Yours,
> Jacky Potop
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>