How to get the type of a unary operator "-" in haskell

In haskell, negative numbers come from using the unary operator '-' before the number, but the subtraction function also uses '-' . Therefore, when you enter :t (-) in ghci, you only get the result of the type of the subtraction function, for example

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

But is it possible to get the type of "negation operator" in ghci? I know this is trivial, but I'm curious.

+7
haskell
source share
1 answer

You could expand it:

 Prelude> :t \x -> -x \x -> -x :: Num a => a -> a 
+10
source share

All Articles