[Haskell-cafe] Re: what are the points in pointsfree?
chad.scherrer at gmail.com
Fri Dec 15 08:23:39 EST 2006
> so pointsfree is a step beyond leaving the domain unspecified.
Actually, the domain is specified - a function written as
f = g . h
has the same domain as h has.
> my reading knowledge of haskell at this point far exceeds my ability
> to write haskell. but so far, it has seemed to me that functions
> written in the pf style are the most reuseable.
> from what you just told me, it's not an artifact of the pf style, but
> that maximally reusable functions will be expressible in a pointsfree
> style. that those functions embody a pattern of computation, without
> concern for the details.
I don't see where reusability is affected either way. Many (all?)
functions can be written in either style, and the definitions are
There are a few advantages I've seen to pf style:
1. Function definitions are shorter, and sometimes clearer.
2. It saves you from having to give points in the domain a name.
3. It can make reasoning about programs simpler. For example, if we know that
reverse . reverse == id
then anywhere we see reverse . reverse, we can replace it with id,
without having to track any other variables. In particular, Richard
Bird's book and articles use this to great effect for program
transformation and derivation from specification ("Bird-Meertens
The only disadvantage I know of is that it can lead to obfuscation,
especially if Haskell hasn't twisted your brain yet (in a good way).
"Time flies like an arrow; fruit flies like a banana" -- Groucho Marx
More information about the Haskell-Cafe