-
Notifications
You must be signed in to change notification settings - Fork 123
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
Better pretty printing of infix type operators with default fixity #670
Comments
A nice solution might be that if we don't declare a fixity for an infix operator, we can print it infix, but always put parentheses around it to make it unambiguous. Similarly, we should probably require disambiguating parentheses when parsing any infix operator without a fixity. In particular, |
I think the current default is that if you don't specify it explicitly it is left-associative. Are you saying we should make the default non-associative? Or just reject uses of operators unless there is an explicit fixity declaration? I don't have a strong opinion, but I think we should probably do the same thing at the value and type. |
I think defaulting to non-associative would make the most sense. (Haskell doesn't do that, but they don't have non-associative operators at all; they probably would if they did.) |
Here is an example:
If we ask for the type of
g
we get this:In contrast, if we add and explicit fixity declaration, for example,
infixl 5 +++
, then we get a much nicer looking type:The text was updated successfully, but these errors were encountered: