[Haskell-beginners] About 'Curry'

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Dec 11 10:27:15 CET 2010


On Fri, Dec 10, 2010 at 1:05 PM, Tobias Brandt
<tob.brandt at googlemail.com> wrote:
> To use an operator as a function you must use the section notation:
>
> pl a = (a ++)

Note that the section notation is slightly more flexible than the
above since you can also do :

> pl b = (++ b)

So that's not currying per se since operators are not syntactically
handled like functions.
Of course behind the scene operators are only functions, to use them
strictly as normal functions Haskell provide the following syntax :

> pl a b = (++) a b

So your first try could be written :

> pl a = (++) a

Just like with an ordinary function.

The second section notation variant (++ b) is perfectly equivalent to
the following :

> pl b = flip (++) b

-- 
Jedaï



More information about the Beginners mailing list