
12 Nov
2009
12 Nov
'09
9:06 a.m.
On Thursday 12 November 2009 01:45:08 am Joe Fredette wrote:
My guess is that, defining in GHCi
let f x = x * 2 let g = \x -> x * 2
the former doesn't default to anything (it just does inference) since it's a function definition, and the latter defaults the '2' to an Integer because it's a value -- or some suitable analog of that situation.
Hmm. Would that also explain this? Prelude> let f1 x = x * 2 Prelude> :type f1 f1 :: (Num a) => a -> a Prelude> let f2 = \x -> f1 x Prelude> :type f2 f2 :: Integer -> Integer Shawn.