Hi -
In the Haskell98 report section 4.4.2 $ is specified as being right associative. This means that f $ a0 a1 $ b0 b1 would parse as f (a0 a1 (b0 b1)) which seems rather strange to me. Surely it would be much more useful if $ were defined as left associative so that it could be used to separate the args to f?

Does anyone know why this strange associativity was chosen?

Thanks, Brian.

(The reason I'm asking is that I'm working on the syntax of a language similar to Haskell but which uses layout to allow expressions like:

f #$ -- can be followed by an explicit block or layout block
                       a0 a1
                       b0 b1

which is sugar for (f $ a0 a1) $ b0 b1 ie f (a0 a1) (b0 b1) ) and I was surprised to discover that the parentheses are needed for the most obvious reading)
Haskell-Cafe mailing list

Reply via email to