Reputation: 7381
I have a function:
let rec loop size elem =
if size <= 0 then []
else elem::( loop (size - 1) elem);;
And if I type it in the utop I got the type int -> 'a -> 'a list = <fun>
which is expected, however if I make a function let loop_3 = loop 3
, the type of loop_3
becomes '_a -> '_a list = <fun>
. The major difference concerning me is that it changes the function from a polymorphic function (whose input is 'a
) to a weak polymorphism function (input type of '_a
). Why is this happening? Is there any way to work around this?
Upvotes: 0
Views: 131