Unary operator
From HaskellWiki
A unary operator is an operator with one parameter. It can be written in prefix notation like in − 2 or in postfix notation 2! (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
negate
The special syntax disallows the use of sectioning.
That is, you cannot writemap (-2)
map (subtract 2)
See also
- Haskell-Cafe: Discussion on unary minus with title map (-2) [1..5]
- Haskell-Cafe: Custom unary operator extension?
