-
Notifications
You must be signed in to change notification settings - Fork 29
Proposal: Make <|> right associative #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This sounds sensible to me. As far as I’m aware, it doesn’t matter as far as correctness goes whether it is a right or left associating operator. How do you see this change affecting users of those existing instances? |
I'm curious about the original reasoning for it being left associative too, shame nobody has replied to your tweet about it. |
It should be non-breaking for law-abiding implementations. There may be potential syntactic effects though? I don't remember the exact parser rules for precedence when faced with competing associativity at the same precedence level. |
Yeah, it comes out as a |
Is there a practical reason for <|> being left associative? In general, it's a control structure, where right-associativity is desirable (eg, what if if/then/else was left associative? It just doesn't make sense). For example, in all the canonical instance for parsers or
Maybe
, orList
s, left associativity leads to terrible evaluation characteristics and almost always requires more work than right-associativity. I always have to define a new local alias when writing parsers because it's a significant improvement.The text was updated successfully, but these errors were encountered: