# Unary operator

From HaskellWiki

A unary operator is an operator with one parameter. It can be written in prefix notation like in or in postfix notation (factorial).

In Haskell there is only one unary operator, namely the unary minus.
It has been discussed in length, whether the unary minus shall be part of numeric literals or whether it shall be an independent operator.
In fact in Haskell it is the latter one, in order to allow expressions like `-a`

.
The unary minus is syntactic sugar for the Prelude function `negate`

.
The special syntax disallows the use of sectioning.
That is, you cannot write `map (-2)`

if you want to substract 2 from all elements of a list.
Instead you have to write `map (subtract 2)`

.

## See also

- Haskell-Cafe: Discussion on unary minus with title
`map (-2) [1..5]`

- Haskell-Cafe: Custom unary operator extension?