unary "-" operator

Thomas Davie tatd2 at kent.ac.uk
Thu Feb 2 18:26:04 EST 2006

I don't know if this is something that's been argued before, but I  
came across an interesting example of why the unary '-' is bad, while  
searching for reasons that single line comments are bad.  A section  
involving the binary minus operator must always be bracketed, and as  
such will always have a '(' infront of it.  That means that this  
example can never happen:

infixl 0 -->

(-->) x y = print x >> print y

f = do { -5 --> 5; return()}

Delete the space after the '{' and you have a problem.  This can't  
happen if you don't have a unary minus.


More information about the Haskell-prime mailing list