| ... | @@ -157,16 +157,16 @@ The operator to the left of prefix -, if there is one, is irrelevant for resolut |
... | @@ -157,16 +157,16 @@ The operator to the left of prefix -, if there is one, is irrelevant for resolut |
|
|
|
|
|
|
|
(Use the algorithm from [ http://hackage.haskell.org/trac/ghc/ticket/4180](http://hackage.haskell.org/trac/ghc/ticket/4180))
|
|
(Use the algorithm from [ http://hackage.haskell.org/trac/ghc/ticket/4180](http://hackage.haskell.org/trac/ghc/ticket/4180))
|
|
|
|
|
|
|
|
### Remark
|
|
### Remarks
|
|
|
|
|
|
|
|
|
|
1. haskellch4.html\#x10-820004.4.2 "4.4.2 Fixity Declarations" states:
|
|
|
haskellch4.html\#x10-820004.4.2 "4.4.2 Fixity Declarations" states:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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).
|
|
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.
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
But 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. (Of course one would not want to reject "-a \* b", no matter how it is resolved.) |
|
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. (Of course one would not want to reject "-a \* b", no matter how it is resolved.) |