
5 Jun
2011
5 Jun
'11
5:33 p.m.
On Sun, Jun 5, 2011 at 07:45, Patrick Browne
Are the following two functions equivalent? (i.e. do they describe the same computation)
let add1 a = a + 2 let add2 = \ a -> a + 2
Mostly. The monomorphism restriction can cause Haskell to restrict the type of the second to "Integer -> Integer". Otherwise, conceptually the first is turned into the second; this is the basis of partial application (think
let addN = \a -> \b -> a + b
which makes it clear that supplying "a" results in "\b -> supplied'a + b" being returned).