[Haskell-cafe] Why is $ right associative instead of leftassociative?

Brian Hulley brianh at metamilk.com
Sat Feb 4 20:47:43 EST 2006


ajb at spamcop.net wrote:
> G'day all.
>
> Quoting ajb at spamcop.net:
>
>> This is the way that I normally express it.  Partly because I find
>> function application FAR more natural than right-associative
>> application,
>
> I meant to say that I find function COMPOSITION more natural than
> right-associative application.  It certainly fits better with my
> personal biases about good functional programming style.

Yes the case you've made for $ being left associative is very compelling - 
namely that the existing associativity actively encourages a *bad* 
programming style in which the right associative $ hides the composition in 
a chain of function applications instead of allowing the composition to be 
explicit and neatly separate from its argument.

Moreover, the existing associativity of $ implies that whoever thought it up 
was confusing two concepts: application and composition, instead of allowing 
"$" to take its proper place as an equal citizen to ".", with the 
associativity proper to its role as application alone.

Thus if $ were made left associative in Haskell Prime, this would add 
clarity to the thought forms associated with the language, which would 
(presumably) in turn lead to better programs being written in it.

Regards, Brian.




More information about the Haskell-Cafe mailing list