Changes between Version 13 and Version 14 of PrefixMinusResolution


Ignore:
Timestamp:
Jul 21, 2010 8:51:59 AM (4 years ago)
Author:
maeder
Comment:

extended remarks

Legend:

Unmodified
Added
Removed
Modified
  • PrefixMinusResolution

    v13 v14  
    119119(Use the algorithm from http://hackage.haskell.org/trac/ghc/ticket/4180) 
    120120 
    121 === Remark === 
    122 haskellch4.html#x10-820004.4.2 "4.4.2  Fixity Declarations" states: 
     121=== Remarks === 
     1221. haskellch4.html#x10-820004.4.2 "4.4.2  Fixity Declarations" states: 
    123123 
    124124"Any operator lacking a fixity declaration is assumed to be infixl 9" 
    125125 
    126 This (surprisingly) makes "{{{- a `f` b}}}" resolve as "{{{- (a `f` b)}}}" for any f without fixity declaration (independent of this proposal). This contradicts NegationBindsTightly. 
     126This (surprisingly) makes "{{{- a `f` b}}}" resolve as "{{{- (a `f` b)}}}" for any f without fixity declaration (independent of this proposal). This contradicts NegationBindsTightly. A fix would be to choose 6 as default precedence. 
    127127 
    128 But 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. (Of course one would not want to reject "-a * b", no matter how it is resolved.) 
     1282. A pattern like "{{{- 1 `f` b}}}" must be rejected for {{{`f`}}} with high precedence (than 6), because prefix minus is only allowed as part of a constant (see http://hackage.haskell.org/trac/ghc/ticket/4176) 
     129 
     1303. 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. (Of course one would not want to reject "-a * b", no matter how it is resolved.)