
14 May
2007
14 May
'07
10:51 a.m.
Matthew Brecknell wrote:
Roberto Zunino:
Here passing both 3 and (\z->z) as y confuses the type inference.
So the type inference is not really confused at all. It just gives a not-very-useful type.
Yes, you are right, I didn't want to involve type classes and assumed 3::Int. A better example would be: polyf :: Int -> a -> Int polyf x y = if x==0 then 0 else if x==1 then polyf (x-1) (\z->z) else polyf (x-2) () Here, passing both () and (\z->z) _does_ make inference fail. Zun.