[Haskell-cafe] |> vs. $ (was: request for code review)

Bill Wood william.wood3 at comcast.net
Mon Mar 6 18:54:37 EST 2006

On Mon, 2006-03-06 at 11:25 -0800, Shannon -jj Behrens wrote:
   . . .
> I find "ctx |> currTok |> tokenType" to be more readable than
> "tokenType $ currTok $ ctx" because you're not reading the code in
> reverse.  That's my primary complaint with "." and "$".  That's
> especially the case when I'm spreading the code over multiple lines:

(Just my $0.02 worth; no flames please :-)  I notice that all but the
last of your four functions read like commands in English.  It seems
natural to write a sequence of commands left-to-right in the order they
are to be performed, so "|>" seem natural and "$" and "." seem backward.
However, if the chain "f $ g $ h x" is read something like "the result
of applying f to the result of applying g to the result of applying h to
x" then the usual order seems more natural.

And my preferences differ from Udo's -- I would not like to see the
order of args to "." and "$" reversed *unless* the arg was written to
the left of the chain, ala "x h $ g $ f", as is done by some

It does seem that the whole controversy boils down to how the writer
thinks of the chain -- as a sequence of actions or as the evolution of a
value.  Neither one is "the One True View"; they're just different.

 -- Bill Wood

More information about the Haskell-Cafe mailing list