[Haskell-cafe] Usage of . and $

Steve Schafer steve at fenestra.com
Wed Mar 7 11:40:43 EST 2007

On Wed, 7 Mar 2007 20:44:42 +1100, you wrote:

>It always irks me that you don't actually save any horizontal space
>using $. That is,
>    (e) x
>has the same number of characters (incl spaces) as
>    e $ x

Parentheses require you to maintain a mental general-purpose push-down
stack as you read the code. $, on the other hand, while it also requires
you to maintain a sort of stack, it's a "monotonic" stack: you may need
to push an arbitrary number of items, but you don't pop anything until
you reach the end of the code. So the mental model required to read code
containing $'s is simpler than that required for parentheses.

Steve Schafer
Fenestra Technologies Corp.

More information about the Haskell-Cafe mailing list