
Hi, Haskell language reference says the special - operator translates to negate. However, this: (+ negate 5) 5 works but this: (+ -5) 5 is not valid. Why? Thanks, Maurício

On Thu, 17 May 2007 13:50:15 -0300
Maurício
Hi,
Haskell language reference says the special - operator translates to negate. However, this:
(+ negate 5) 5
Function application binds tightest, so this is equivalent to: (+ (negate 5)) 5
works but this:
(+ -5) 5
In this context, it's trying to parse - as the binary subtraction operator. The special treatment of - in its unary context is that (-5) is (negate 5) and not the section ((-) 5)
is not valid. Why?
Thanks, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Matthew William Cox
participants (2)
-
Matthew William Cox
-
Maurício