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

Brian Hulley brianh at metamilk.com
Sun Feb 5 08:14:42 EST 2006


Tomasz Zielonka wrote:
> The only problem I see right now is related to change locality. If I
> have a chain like this:
> 
>    f x y .
>    g x $
>    z
> 
> and I want to add some transformation between g and z I have to
> change one line and insert another
> 
>    f x y .
>    g x .
>    h x y $
>    z
> 
> With right-associative $ it would be only one line-add. Probably not a
> very strong argument.

How about:

      f x y
      . g x
      $ z

then you only need to add the line

      . h x y

This is similar to how people often format lists:

     a =
          [ first
          , second
          , third
          ]

Regards, Brian.


More information about the Haskell-Cafe mailing list