[Haskell-cafe] Why are && and || right-associative?

Joachim Durchholz jo at durchholz.org
Fri Apr 12 19:15:36 UTC 2019


Am 12.04.19 um 11:21 schrieb Richard O'Keefe:
> It has 
> never been the case that all operators in all programming languages were 
> left associative.  For addition and subtraction it matters; you don't 
> want a-b+c interpreted as a-(b+c), but not for || and not for &&.  My 
> expectation is that these operators should be right associative.

What is the basis for this expectation?
My expectation would be left associativity, just because I read stuff 
from left to right, and left associativity is what I get if I mentally 
parse from left to right.
So I'm curious what thought process arrives at the opposite expectation.

Regards,
Jo


More information about the Haskell-Cafe mailing list