[Haskell-cafe] Why is $ right associative instead of left
brianh at metamilk.com
Sat Feb 4 09:52:20 EST 2006
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?
(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
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
More information about the Haskell-Cafe