List Info

Thread: "ocaml_beginners"::[] How to pass a map as an argument




"ocaml_beginners"::[] How to pass a map as an argument
country flaguser name
United States
2008-03-03 18:32:43

I'm trying to write a type that can hold a function like ('a Map.Make
(String).t -> int list -> int) but when I do this I get the
error "Unbound type parameter 'a". What's the best way to solve this?

The actual code is:

type expr = Fn of ('a Map.Make(String).t -> int list -> int);;

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] How to pass a map as an argument
country flaguser name
United States
2008-03-03 18:43:12

On Tue, 4 Mar 2008, knighttemplar0184 wrote:

> I'm trying to write a type that can hold a function like ('a Map.Make
> (String).t -> int list -> int) but when I do this I get the
> error "Unbound type parameter 'a". What's the best way to solve this?
>
> The actual code is:
>
> type expr = Fn of ('a Map.Make(String).t -> int list -> int);;

type 'a expr = ...

If you have several parameters, use parens and commas:

type ('a, 'b, 'foo, 'bar) expr = ...

Martin

--
http://wink.com/profile/mjambon
http://martin.jambon.free.fr

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )