List Info

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




"ocaml_beginners"::[] Re: How to pass a map as an argument
country flaguser name
United States
2008-03-03 19:24:09

--- In ocaml_beginners%40yahoogroups.com">ocaml_beginnersyahoogroups.com, Martin Jambon
<martin_jambon...> wrote:
&gt;
> On Tue, 4 Mar 2008, knighttemplar0184 wrote:
&gt;
> > 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);;
&gt;
> type 'a expr = ...
>
> If you have several parameters, use parens and commas:
>
> type ('a, 'b, 'foo, 'bar) expr = ...
>
>
>
> Martin
&gt;
> --
> http://wink.com/profile/mjambon
> http://martin.jambon.free.fr
>

How about in a recursive type like "type 'a expr = Num of int | Fn of
(('a Map.Make(String).t) -> expr list -> expr);;&quot;? This gives an
error because the second expr list and expr don't need the 'a but
expect it anyways.

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] Re: How to pass a map as an argument
country flaguser name
France
2008-03-03 19:19:05

On Tue, 04 Mar 2008 01:24:09 -0000
&quot;knighttemplar0184&quot; < jperalta17%40gmail.com">jperalta17gmail.com> wrote:

> How about in a recursive type like "type 'a expr = Num of int | Fn of
> (('a Map.Make(String).t) -> expr list -> expr);;&quot;? This gives an
> error because the second expr list and expr don't need the 'a but
> expect it anyways.
>

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

__._,_.___
.

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

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