|
|
|
# Proposal: NegationBindsTightly
|
|
|
|
|
|
|
|
|
|
|
|
<table><tr><th> Ticket </th>
|
|
|
|
<th>[\#135](https://gitlab.haskell.org//haskell/prime/issues/135)</th></tr>
|
|
|
|
<th> \#999
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> Dependencies </th>
|
|
|
|
<th> names of other proposals on which this one depends
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> Related </th>
|
|
|
|
<th>[NegativeSyntax](negative-syntax)</th></tr></table>
|
|
|
|
<th> [NegativeSyntax](negative-syntax)
|
|
|
|
</th></tr></table>
|
|
|
|
|
|
|
|
|
|
|
|
## Compiler support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
None at present
|
|
|
|
|
|
|
|
|
|
|
|
## Summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Which of these definitions are correct Haskell?
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
x1 = 4 + -5
|
|
|
|
x2 = -4 + 5
|
| ... | ... | @@ -30,6 +38,7 @@ Which of these definitions are correct Haskell? |
|
|
|
|
|
|
|
Ghc accepts x2, x4, x6 and rejects the others with a message like
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
Foo.hs:4:7:
|
|
|
|
Precedence parsing error
|
| ... | ... | @@ -39,21 +48,28 @@ Foo.hs:4:7: |
|
|
|
|
|
|
|
Hugs and Helium accept them all. I think that Hugs is right here. After all, there is no ambiguity in any of these expressions. And an application-domain user found this behaviour very surprising.
|
|
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Make unary minus bind more tightly than any other operator. But not more tightly than function application.
|
|
|
|
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
External references, papers, articles, support in other languages.
|
|
|
|
|
|
|
|
|
|
|
|
## Report Delta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Something like deleting
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
lexp6 -> - exp7
|
|
|
|
```
|
| ... | ... | @@ -61,9 +77,12 @@ Something like deleting |
|
|
|
|
|
|
|
and adding the production
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
exp10 -> - fexp
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
but this relates to Haskell 98 rather than Haskell 2010, so the exact change will differ.
|
|
|
|
|
|
|
|
|