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

Tomasz Zielonka tomasz.zielonka at gmail.com
Sun Feb 5 11:42:35 EST 2006

On Sun, Feb 05, 2006 at 04:36:44PM -0000, Brian Hulley wrote:
> Just in case you are interested, in the "preprocessor" I'm writing, I would 
> write these examples as:
>        (.) #>
>                   f x y
>                   g x
>                   h x y
>        $ z
> and
>         a = #[
>                    first
>                    second
>                    third
> where exp #> {e0,e1,...} is sugar for let a = exp in a e0 (a e1 (a ... ) 
> ...)) and #[ {e0, e1, ... } is sugar for [e0, e1, ...]            (exp #> 
> block and exp #< block are the right and left associative versions 
> respectively and the special # sugar allows a layout block to be started if 
> it occurs at the end of a line)

Well... I care about change locality and the like, but I'm not sure
I would use such syntax (as a means of communication between
programmers). Perhaps that's because I am not used to it and it looks
alien. But it's rather because I still put readability first.

> This allows me to avoid having to type lots of syntax eg repeating the "." 
> all the time and focus on the semantics...

At some point you (the programmer) are going to do the work of a
compression program ;-)

There is some limit to terseness. Haskell's syntax is quite concise, but
it could be even more. Why it isn't? Because it would cease to resemble
the mathematical notation, it would cease to be readable. Well, even
Haskell could be more readable, but there's also some point where
further investment in concise lexical syntax doesn't pay off. I am not
sure that's the situation here, but... think about it.

PS. One wonders why you don't take the lisp way with a good lisp editor?
    Aren't you designing lisp without parentheses? ;-)

Best regards

I am searching for programmers who are good at least in
(Haskell || ML) && (Linux || FreeBSD || math)
for work in Warsaw, Poland

More information about the Haskell-Cafe mailing list