[Haskell-beginners] Re: Function composition
with more than 1 parameter
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Sat Oct 25 19:22:58 EDT 2008
On 2008 Oct 25, at 18:44, Glurk wrote:
>> Or, does it take the only valid parameter I give it, the a, and
>> then form a
> function out of this (a==), and then compose this new function with
> which does take a function of this new type. Then, there is one
> left, [a], which is what this new function needs...and so it all
> works out !
This is it exactly.
> Why doesn't it try to take the 2 parameters for (==)
In reality there are no two-parameter functions. They are actually
single-parameter functions which return functions. Thus only one
argument will ever be consumed by a particular application.
Symbolically: (\a b -> f a b) = \a -> (\b -> f a b) taking argument a
and returning the function (\b -> f a b) with a having whatever value
it was given in the first application (in other languages this is
often referred to as a closure).
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Beginners