[Haskell-cafe] Re: haskell programming guidelines
cgibbard at gmail.com
Sat Mar 4 02:32:41 EST 2006
On 01/03/06, Christian Maeder <maeder at tzi.de> wrote:
> In a more realistic example, the current dollars help to improve
> readability, I think, and that is my argument why "$" should be right-
> map (+ 1) $ filter (/= 0) $ Set.toList l
> An additional $ before the final argument (" $ l") looks stupid to me.
> I also find additional parentheses instead of the dollars more
> confusing, because of the other parts in parentheses.
If you don't like
map (+ 1) . filter (/= 0) . Set.toList $ l
map (+ 1) . filter (/= 0) $ Set.toList l
works just as well. In this case it's also a fairly natural way to
break up the thought process. Your main computation is solely a
composition of list functions, and the conversion is part of how you
get the input to it.
More information about the Haskell-Cafe