| ... | @@ -30,7 +30,7 @@ |
... | @@ -30,7 +30,7 @@ |
|
|
|
|
|
|
|
Resolve more prefix minus application unambiguously by:
|
|
Resolve more prefix minus application unambiguously by:
|
|
|
|
|
|
|
|
1. Considering only operators to the right of prefix negation (as currently done only by Hugs)
|
|
1. Considering only operators to the right of prefix negation (as currently done by Hugs)
|
|
|
|
|
|
|
|
1. Leave prefix minus bind less tight than multiplication (as is currently done)
|
|
1. Leave prefix minus bind less tight than multiplication (as is currently done)
|
|
|
|
|
|
| ... | @@ -168,10 +168,12 @@ The operator to the left of prefix -, if there is one, is irrelevant for resolut |
... | @@ -168,10 +168,12 @@ The operator to the left of prefix -, if there is one, is irrelevant for resolut |
|
|
"Any operator lacking a fixity declaration is assumed to be infixl 9"
|
|
"Any operator lacking a fixity declaration is assumed to be infixl 9"
|
|
|
|
|
|
|
|
|
|
|
|
|
This (surprisingly) makes "`- a `f` b`" resolve as "`- (a `f` b)`" for any f without fixity declaration (independent of this proposal). This contradicts [NegationBindsTightly](negation-binds-tightly). A fix would be to choose 6 as default precedence.
|
|
This (surprisingly) makes "`- a `f` b`" resolve as "`- (a `f` b)`" for any f without fixity declaration (independent of this proposal). This contradicts [NegationBindsTightly](negation-binds-tightly).
|
|
|
|
|
|
|
|
1. A pattern like "`- 1 `f` b`" must be rejected for ``f`` with high precedence (than 6), because prefix minus is only allowed as part of a constant (see [ http://hackage.haskell.org/trac/ghc/ticket/4176](http://hackage.haskell.org/trac/ghc/ticket/4176))
|
|
1. A pattern like "`- 1 `f` b`" must be rejected for ``f`` with higher precedence (than 6), because prefix minus is only allowed as part of a constant (see [ http://hackage.haskell.org/trac/ghc/ticket/4176](http://hackage.haskell.org/trac/ghc/ticket/4176))
|
|
|
|
|
|
|
|
1. As a compromise it is also an option to simple reject terms where prefix minus would not bind tightly (enough), which makes sense for `-a ^ b` and would force us to write `-(a ^ b)` or `(-a) ^ b` explicitly.
|
|
1. As a compromise it is also an option to simple reject terms where prefix minus would not bind tightly (enough), which makes sense for `-a ^ b` and would force us to write `-(a ^ b)` or `(-a) ^ b` explicitly.
|
|
|
|
|
|
|
|
1. One would not want to reject "-a \* b", no matter how it is resolved, but it would make a difference for ``mod``, i.e. `- 1 `mod` 4`!
|
|
1. One would not want to reject "-a \* b", no matter how it is resolved, but it would make a difference for ``mod``, i.e. `- 1 `mod` 4`!
|
|
|
|
|
|
|
|
1. An incompatible fix for remark 1 would be to choose a different default precedence, i.e. 6. But since (in my eyes) ``mod`` is resolved the wrong way currently and we make incompatible changes anyway, it would make sense to increase the precedence of prefix minus to be just higher than multiplication (but still lower than exponentiation) and set the default precedence to 7 (like for multiplication). |