#4180: do not consider associativity for unary minus for fixity resolution
---------------------------------+------------------------------------------
Reporter: maeder | Owner:
Type: proposal | Status: new
Priority: normal | Component: Compiler
Version: 6.12.3 | Keywords: fixity resolution
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
1. currently an expression "1 + - 1" is rejected, because "1 + (-1)"
looks as being bracketed to the right, whereas + and - are left
associative. However, no other bracketing is possible, so "1 + - 1" is
unambiguous and should not be subject to further fixity resolution.
2. if an infix expressions starts with an unary minus, the associativity
should not matter for the unary minus. Why should "- 1 ## 1" be rejected
for a right- or non-assoc operator "##"? Precedence alone is sufficient to
decide between "(- 1) ## 1" and "- (1 ## 1)". The latter choice is taken
for a higher precedence of the infix operator and the former choice should
always be taken
for an equal or lower precedence as is done for "- 1 + 1", but without
looking at associativity!
I'll attach an alternative fixity resolution in the spirit of
10.6 of http://www.haskell.org/~simonmar/haskell-2010-draft-
report-2/haskellch10.html
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4180>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs