On Sun, Jun 5, 2011 at 07:45, Patrick Browne <patrick.bro...@dit.ie> wrote:
> 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).

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to