The minus operator in Haskell

In a previous post, concerning the two ways Haskell does function application, I was using as examples arithmetic operations. Among other things I said (I actually cited from Real World Haskell) that the minus (-) operator is Haskell’s only unary operator. I also said that it looks wrong to me, but I was wrong in fact. According to the Haskell 98 report, the operators section, the syntax -x, where x is a number, is a special form and it is indeed the only prefix (and unary) operator in Haskell. Additionally, the minus (-) function used in expressions of form x - y is actually the binary (it takes two arguments) function minus (-), about which we can find the type signature:

Prelude> :t (-)
(-) :: (Num a) => a -> a -> a

The unary operator minus ((-)) has no relationship with the binary operator. It is actually an equivalent of the negate function. So, if we want to find the type signature of the minus (-) unary operator we must do:

Prelude> :t negate
negate :: (Num a) => a -> a

Yay! I clarified yet another thing in my Haskell journey.