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
Add real error messages for associativity errors #3315
Conversation
|
||
import Prelude | ||
|
||
feq f x y = f <$> x == f <$> y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case was a little surprising, but GHC has an error for it too:
Prelude> let f x y = f <$> x == f <$> y
<interactive>:10:13:
Precedence parsing error
cannot mix ‘<$>’ [infixl 4] and ‘==’ [infix 4] in the same infix expression
<interactive>:10:13:
Precedence parsing error
cannot mix ‘==’ [infix 4] and ‘<$>’ [infixl 4] in the same infix expression
|
||
import Prelude | ||
|
||
a = true == true == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GHC again:
Prelude> True == True == True
<interactive>:11:1:
Precedence parsing error
cannot mix ‘==’ [infix 4] and ‘==’ [infix 4] in the same infix expression
I think we’ll need to update the docs for fixities now - it sounds to me like the docs I wrote might not all still apply, and there might be cases where the examples in the docs now produce these errors. |
Ah ok, I'll open an issue over there as a reminder. |
Resolves #3310
The code for generating the errors is kinda absurd as it's more complicated than the actual rebracketing code (since using parsec hides a bunch of that), but whatyagonnado.