Negation
Cale Gibbard
cgibbard at gmail.com
Sun Feb 21 20:17:24 EST 2010
> But I agree they should all be legal, i.e. that unary minus should bind
> more tightly than any infix operator (as in C).
I'd just like to interject that I disagree, and think that the current
behaviour is about as good as one could hope for. Negation is an
additive operation, and thus has lower precedence than multiplication
and exponentiation.
-x^2 must be interpreted as -(x^2), not as (-x)^2.
Similarly, though it seems to confuse some people, it makes more sense
that - x `mod` y is parsed as - (x `mod` y) since mod has to do
with multiplication, so it should bind more tightly than additive
operations.
- Cale
More information about the Haskell-prime
mailing list