Changes between Version 10 and Version 11 of PrefixMinusResolution


Ignore:
Timestamp:
Jul 14, 2010 11:49:49 AM (5 years ago)
Author:
maeder
Comment:

more comments on nhc98

Legend:

Unmodified
Added
Removed
Modified
  • PrefixMinusResolution

    v10 v11  
    6161}}}
    6262
    63 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.
     63x7 are currently rejected by Hugs and ghc. Two solutions are possible. By accident nhc98 resolves this as "-(4 # 5), because # is not left-associative.
     64I think associativity should only matter for two infix operators. Since "-" should just bind weaker than multiplication "(-4) # 5" should be the unique solution!
     65
     66{{{
     67infixr # 6
     68(#) = (-)
     69x8 = - 4 # 5 # 6
     70}}}
     71
     72x8 will be resolved as "(- 4) # (5 # 6)" like it would for any right-associative operator # with lower precedence, too. For any
     73''non-associative'' operator # "- 4 # 5 # 6" is rejected like "4 # 5 # 6" or "-(4 # 5 # 6)" would be.
    6474
    6575Surely, one can always disallow "confusing" resolutions, but if we reject "- 4 # 5", we can also reject "- 4 - 5" or "`- 4 ^ 5`".
    66 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.)
     76Associativity 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.)
    6777
    6878As a further option it is possible to support multiple prefix minus application. ("4 * - - 5" can be resolved in the same way as