[Haskell-cafe] Re: Point-free style (Was: Things to avoid)

Christian Maeder maeder at tzi.de
Fri Feb 11 05:08:17 EST 2005


ajb at spamcop.net wrote:
> 
> Note that "currying" applies to operator sections too.  The idiom of
> "pipelined functions" deserves its own special mention:
> 
>     countlines = length . lines
> 
> But this is really a shorthand for:
> 
>     countlines cs = length . lines $ cs

an interesting use of $ (in conjunction with another infix). I usually 
write:

    countlines cs = length $ lines cs

or more general

f = g . h . i

becomes

f x = g $ h $ i x

Christian


More information about the Haskell-Cafe mailing list