[Haskell-cafe] Re: Point-free style (Was: Things to avoid)
sebastian.sylvan at gmail.com
Thu Feb 10 22:11:57 EST 2005
On Thu, 10 Feb 2005 18:04:26 -0800 (PST), oleg at pobox.com <oleg at pobox.com> wrote:
> Jan-Willem Maessen wrote:
> ] Is it really clear or obvious what
> ] > map . (+)
> ] means?
> Perhaps the following two examples might be more convincing:
> > u=uncurry
> > e=((partition $ u(==)).) . zip
> > f x=(x\\).(x\\)
> It is obviously clear what 'e' and 'f x' do.
I would have to disagree there... Show that to someone who's just
taken an intro course in Haskell and ask them what they mean and
you'll see what I mean. Even if they know how the . operator works it
would still take several minutes of reasoning to figure out what it
Only if you've taken considerable time to get a solid intuition for
points-free style by using it extensively would the last two of those
example ever be "obvious".
I am, like some others, of the opinion that using points-free style
almost always makes the code less clear for basically everyone else.
Trivial examples such as:
> double = 2*
can be tolerated, but in general you only stand to gain clarity from
exlicitly writing out the parameters to the function.
Points free style is cool in a geeky sort of way, but not really all
that useful when you're trying to write clear code that people can
More information about the Haskell-Cafe