base-3.0.1.0: Basic librariesSource codeContentsIndex
GHC.Num
Portabilitynon-portable (GHC Extensions)
Stabilityinternal
Maintainercvs-ghc@haskell.org
Description
The Num class and the Integer type.
Synopsis
class (Eq a, Show a) => Num a where
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
abs :: a -> a
signum :: a -> a
fromInteger :: Integer -> a
subtract :: Num a => a -> a -> a
quotRemInt :: Int -> Int -> (Int, Int)
divModInt :: Int -> Int -> (Int, Int)
data Integer
= S# Int#
| J# Int# ByteArray#
zeroInteger :: Integer
int2Integer :: Int -> Integer
integer2Int :: Integer -> Int
quotRemInteger :: Integer -> Integer -> (Integer, Integer)
remInteger :: Integer -> Integer -> Integer
quotInteger :: Integer -> Integer -> Integer
gcdInteger :: Integer -> Integer -> Integer
lcmInteger :: Integer -> Integer -> Integer
divExact :: Integer -> Integer -> Integer
enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> b
enumDeltaInteger :: Integer -> Integer -> [Integer]
jtos :: Integer -> String -> String
Documentation
class (Eq a, Show a) => Num a whereSource

Basic numeric class.

Minimal complete definition: all except negate or (-)

Methods
(+) :: a -> a -> aSource
(*) :: a -> a -> aSource
(-) :: a -> a -> aSource
negate :: a -> aSource
Unary negation.
abs :: a -> aSource
Absolute value.
signum :: a -> aSource

Sign of a number. The functions abs and signum should satisfy the law:

 abs x * signum x == x

For real numbers, the signum is either -1 (negative), 0 (zero) or 1 (positive).

fromInteger :: Integer -> aSource
Conversion from an Integer. An integer literal represents the application of the function fromInteger to the appropriate value of type Integer, so such literals have type (Num a) => a.
show/hide Instances
subtract :: Num a => a -> a -> aSource

the same as flip (-).

Because - is treated specially in the Haskell grammar, (- e) is not a section, but an application of prefix negation. However, (subtract exp) is equivalent to the disallowed section.

quotRemInt :: Int -> Int -> (Int, Int)Source
divModInt :: Int -> Int -> (Int, Int)Source
data Integer Source
Arbitrary-precision integers.
Constructors
S# Int#
J# Int# ByteArray#
show/hide Instances
zeroInteger :: IntegerSource
int2Integer :: Int -> IntegerSource
integer2Int :: Integer -> IntSource
quotRemInteger :: Integer -> Integer -> (Integer, Integer)Source
remInteger :: Integer -> Integer -> IntegerSource
quotInteger :: Integer -> Integer -> IntegerSource
gcdInteger :: Integer -> Integer -> IntegerSource
lcmInteger :: Integer -> Integer -> IntegerSource
divExact :: Integer -> Integer -> IntegerSource
enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> bSource
enumDeltaInteger :: Integer -> Integer -> [Integer]Source
jtos :: Integer -> String -> StringSource
Produced by Haddock version 2.0.0.0