| ... | ... | @@ -151,10 +151,6 @@ Python's power operator binds more tightly than unary operators on its left, [ h |
|
|
|
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
My point 3 above is backed by the fact that "in case of doubt" prefix application should bind stronger than infix application.
|
|
|
|
|
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -174,7 +170,7 @@ This (surprisingly) makes "`- a `f` b`" resolve as "`- (a `f` b)`" for any f wit |
|
|
|
|
|
|
|
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).
|
|
|
|
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). In case of doubt prefix application should bind stronger than infix application, but I do not want to make a proposal here, that would break compatibility.
|
|
|
|
|
|
|
|
## Report Delta
|
|
|
|
|
| ... | ... | @@ -185,21 +181,29 @@ In |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remove "same precedence" stuff
|
|
|
|
remove "same precedence" stuff elsewhere (sections 3 and 3.4) and maybe add references to section 10.6 "Fixity Resolution".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remove:
|
|
|
|
haskellch3.html\#x8-220003
|
|
|
|
"Negation is the only prefix operator in Haskell; it has the same precedence as the infix - operator defined in the Prelude (see Section 4.4.2, Figure 4.1)."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remove:
|
|
|
|
haskellch3.html\#x8-280003.4
|
|
|
|
"Prefix negation has the same precedence as the infix operator - defined in the Prelude (see Table 4.1)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Possibly refer to haskellch10.html\#x17-17900010.6 "10.6 Fixity Resolution"
|
|
|
|
extend:
|
|
|
|
"patterns are a subset of expressions so in what follows we consider only expressions for simplicity."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with:
|
|
|
|
"Note, that prefix minus within patterns is only allowed for numeric constants that must not be followed by an infix operator of higher precedence without brackets."
|
|
|
|
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -215,5 +219,15 @@ 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))
|
|
|
|
The description of the algorithm needs to be rewritten, too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
omit:
|
|
|
|
"If we encounter a negation operator, and it is legal in this position (the operator to the left has precedence lower than 6), then we proceed in a similar way to case (3) above"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(negation is always legal, it's only a question how far it extends to the right)
|
|
|
|
|
|
|
|
|