Thanks for your time.
The following small class definition causes an error in method "map":
class ['a] lst (pl:'a list) =
object(self:'o)
val l = pl
method cons (v:'a) = {< l = v::l >}
method hq () =
match l with
[] -> None
| h::q -> Some(h,{<l=q>})
method to_list () = l
method map : 'b. ('a->'b) -> ('b lst) =
fun f ->
match self#hq() with
None -> new lst []
| Some(h,q) -> (q#map f)#cons (f h)
end;;
This type 'a should be an instance of type 'b
The universal variable 'a would escape its scope
I've tried lots of different posibilities, but all they gives an error
or constraints "f" to a function " 'a->'a ".
There are only 3 references in this group to similar problems, but I
can not find anyone with a solution.
Any sugestion?
Thanks.