Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: negate: Change the sign of a number


Haskell provides Negate function, which change the sign of a number. Following is the signature of negate function.
Prelude> :t negate
negate :: Num a => a -> a


As you see the signature, negate function takes any value, which is of type number and change the sign.
Prelude> negate 10
-10
Prelude> negate (-10)
10
Prelude> negate 10.01
-10.01
Prelude> negate (-10.01)
10.01



Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: negate: Change the sign of a number

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×