And here is such an example
fun append(nil,l) = l | append(hd:tl,l) = hd::append(tl,l);
val append = fn : ‘a list * ‘a list -> ‘a list
All three ‘a type variables must have the same type
append([1,2],[3]);
[1,2,3] : int list;
append([“w”,”us”],[”s”]);
[“w”,”us”,”s”] : string list;
append([1,2],[“s”]);
…type error…
Previous slide
Next slide
Back to first slide
View graphic version