[Haskell-cafe] Functions that return functions
rmm-haskell at z.odi.ac
Sun Apr 12 21:23:34 EDT 2009
Under the covers of syntax they only have one parameter, but you can
write curried lambdas or functions easily:
\ a b -> a + b
which is equivalent to
\ a -> \ b -> a + b
and also equivalent to the "normal" function syntax
f a b = a + b
f a = \ b -> a + b
On Apr 12, 2009, at 9:09 PM, michael rice wrote:
> My question was meant in the context of the makeVerifier function,
> which is passed a lambda expression. It's my understanding that
> Haskell lambda expressions can have only a single parameter, which
> is why I changed the function parameter to a pair, (i,d).
> How would it be done otherwise?
> --- On Sun, 4/12/09, Daniel Fischer <daniel.is.fischer at web.de> wrote:
> From: Daniel Fischer <daniel.is.fischer at web.de>
> Subject: Re: [Haskell-cafe] Functions that return functions
> To: "michael rice" <nowgate at yahoo.com>
> Cc: haskell-cafe at haskell.org
> Date: Sunday, April 12, 2009, 7:20 PM
> Am Montag 13 April 2009 01:09:22 schrieb michael rice:
> > Example please.
> > Michael
> f :: a -> b -> c
> amenable to partial application.
> g :: (a,b) -> c
> not easy to apply partially.
> The Prelude contains
> curry :: ((a,b) -> c) -> (a -> b -> c)
> uncurry :: (a -> b -> c) -> ((a,b) -> c)
> to convert if needed.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe