| ... | ... | @@ -148,7 +148,6 @@ Other specification languages (like HasCASL) do so, too. For instance the logica |
|
|
|
|
|
|
|
|
|
|
|
Python's power operator binds more tightly than unary operators on its left, [ http://docs.python.org/reference/expressions.html](http://docs.python.org/reference/expressions.html), -1**2 results in -1.
|
|
|
|
**
|
|
|
|
|
|
|
|
|
|
|
|
## Remarks
|
| ... | ... | @@ -161,14 +160,14 @@ Python's power operator binds more tightly than unary operators on its left, [ h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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).
|
|
|
|
|
|
|
|
|
|
|
|
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. 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). 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.
|
|
|
|
|
| ... | ... | |