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

Matthew Walton matthew at alledora.co.uk
Fri Feb 11 05:42:23 EST 2005


David Menendez wrote:
> Here's another one:
> 
>     addTriple (s,p,o) = addArc s p o . addNode s . addNode p . addNode o
> 
> I like to think it's pretty straightforward.
> 
> I suppose you could argue that these are examples of "semi-point-free"
> style, or something. Certainly, I wouldn't want to rewrite tsArcFwd or
> addTriple into fully point-free style.

This is closest to where my code tends to end up. I like some of the 
implications of point-free style, but I generally tend to avoid 
point-free stuff involving functions which take more than one argument - 
in that case, I'll generally make at least one of the arguments 
explicit. It helps me write the function and makes the code more 
self-documenting - at least to my mind.

Of course, point-free code becomes much clearer with a nice type 
signature. As does pretty much all other Haskell code.



More information about the Haskell-Cafe mailing list