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

ajb at spamcop.net ajb at spamcop.net
Thu Feb 10 23:47:32 EST 2005

G'day all.

Quoting Sebastian Sylvan <sebastian.sylvan at gmail.com>:

> I am, like some others, of the opinion that using points-free style
> almost always makes the code less clear for basically everyone else.

Count me among the "some others".

There are basically two situations where "pointless style" makes sense
for me.

1. Currying, when passing a value to a higher-order function.


    map head xss


    map (\xs -> head xs) xss

2. Currying, at the level of a rule.


    heads xss = map head xss


    heads = map head

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

I pretty much never use any other uses of pointless style.

Mind you, I don't do any arrow programming.

Mind you, this is probably why I don't do any arrow programming. :-)

Andrew Bromage

More information about the Haskell-Cafe mailing list