Simon Marlow wrote:
...

Really? I'm beginning to have second thoughts about the proposed change to negation for Haskell'. The main reason, and this isn't pointed out as well as it should be on the wiki, is that "x-1" will cease to be an infix application of (-), it will parse as x applied to the literal (-1). And this is different from "x - 1"

There is one other alternative for parsing:
   "-" is a unary minus if and only if it is
       a) preceded by whitespace or one of "[({;,", and
       b) not followed by whitespace.

So:
  x - 1     ==    (-) x 1
  x-1       ==    (-) x 1
  x -1      ==    x (negate 1)
  x -(1)    ==    x (negate 1)
  x (-1)    ==    x (negate 1)
  x (- 1)   ==    x (\y -> y - 1)

Just an idea.

Twan
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to