| ... | ... | @@ -82,11 +82,22 @@ x7 = - 4 # 5 |
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
x7 are currently rejected by Hugs and ghc. Two solutions are possible. Since "-" should just bind weaker than multiplication the possibility "-(4 \# 5)" cannot be justified, thus "(-4) \# 5" should be the unique solution.
|
|
|
|
x7 are currently rejected by Hugs and ghc. Two solutions are possible. By accident nhc98 resolves this as "-(4 \# 5), because \# is not left-associative.
|
|
|
|
I think associativity should only matter for two infix operators. Since "-" should just bind weaker than multiplication "(-4) \# 5" should be the unique solution!
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
infixr # 6
|
|
|
|
(#) = (-)
|
|
|
|
x8 = - 4 # 5 # 6
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
x8 will be resolved as "(- 4) \# (5 \# 6)" like it would for any right-associative operator \# with lower precedence, too. For any
|
|
|
|
*non-associative* operator \# "- 4 \# 5 \# 6" is rejected like "4 \# 5 \# 6" or "-(4 \# 5 \# 6)" would be.
|
|
|
|
|
|
|
|
|
|
|
|
Surely, one can always disallow "confusing" resolutions, but if we reject "- 4 \# 5", we can also reject "- 4 - 5" or "`- 4 ^ 5`".
|
|
|
|
Associativity seems wrong to consider for the unary minus function. (But it is an option to simple use the way of Hugs for ghc, too.)
|
|
|
|
Associativity seems wrong to consider for the unary minus function. (But it is an option to simple use the way of Hugs or nhc98 for ghc, too.)
|
|
|
|
|
|
|
|
|
|
|
|
As a further option it is possible to support multiple prefix minus application. ("4 \* - - 5" can be resolved in the same way as
|
| ... | ... | |