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

Udo Stenzel u.stenzel at web.de
Mon Mar 6 15:42:41 EST 2006


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 "$".

Seconded.  That's why I'd like to see the arguments to (.) swapped, but
it's too late for that.  A useable replacement is (>>>) from the Arrow
instance for (->), which gives:

> translate :: String -> String
> translate =
>   createParseContext >>>
>   readToFirstIdentifier >>>
>   dealWithDeclarator >>>
>   consolidateOutput
 
It reads from left to right and it promotes a more functional style.
The operator could be a bit easier on the eyes, though.


Udo.
-- 
Always call a spade a spade, except in classes that both dig holes and
play bridge.
	-- a guideline for Eiffel programmers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060306/40d8b075/attachment.bin


More information about the Haskell-Cafe mailing list