GHC.Num

base-4.15.0.0: Basic libraries

Copyright | (c) The University of Glasgow 1994-2002
License | see libraries/base/LICENSE
Maintainer | cvs-ghc@haskell.org
Stability | internal
Portability | non-portable (GHC Extensions)
Safe Haskell | Trustworthy
Language | Haskell2010

GHC.Num

Description

The `Num` class and the `Integer` type.

Synopsis

- class Num a where
  - (+), (-), (*) :: a -> a -> a
  - negate :: a -> a
  - abs :: a -> a
  - signum :: a -> a
  - fromInteger :: Integer -> a
- subtract :: Num a => a -> a -> a
- quotRemInteger :: Integer -> Integer -> (# Integer, Integer #)
- module GHC.Num.Integer
- module GHC.Num.Natural
- module GHC.Natural
- module GHC.Integer

# Documentation

class Num a where Source #

Basic numeric class.

The Haskell Report defines no laws for `Num`. However, `(`+`)` and `(`*`)` are customarily expected to define a ring and have the following properties:

Associativity of `(`+`)`
  `(x + y) + z` = `x + (y + z)`
Commutativity of `(`+`)`
  `x + y` = `y + x`
``fromInteger` 0` is the additive identity
  `x + fromInteger 0` = `x`
`negate` gives the additive inverse
  `x + negate x` = `fromInteger 0`
Associativity of `(`*`)`
  `(x * y) * z` = `x * (y * z)`
``fromInteger` 1` is the multiplicative identity
  `x * fromInteger 1` = `x` and `fromInteger 1 * x` = `x`
Distributivity of `(`*`)` with respect to `(`+`)`
  `a * (b + c)` = `(a * b) + (a * c)` and `(b + c) * a` = `(b * a) + (c * a)`

Note that it isn't customarily expected that a type instance of both `Num` and `Ord` implement an ordered ring. Indeed, in `base` only `Integer` and `Rational` do.

Minimal complete definition

(+), (*), abs, signum, fromInteger, (negate | (-))

Methods

(+) :: a -> a -> a infixl 6 Source #

(-) :: a -> a -> a infixl 6 Source #

(*) :: a -> a -> a infixl 7 Source #

negate :: a -> a Source #

Unary negation.

abs :: a -> a Source #

Absolute value.

signum :: a -> a Source #

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 -> a Source #

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`.

#### Instances

Instances details

Num Double # | Note that due to the presence of `NaN`, not all elements of `Double` have an additive inverse.
    >>> 0/0 + (negate 0/0 :: Double)
    NaN
Also note that due to the presence of -0, `Double`'s `Num` instance doesn't have an additive identity
    >>> 0 + (-0 :: Double)
    0.0
Since: base-2.1
Instance details Defined in GHC.Float Methods (+) :: Double -> Double -> Double Source # (-) :: Double -> Double -> Double Source # (*) :: Double -> Double -> Double Source # negate :: Double -> Double Source # abs :: Double -> Double Source # signum :: Double -> Double Source # fromInteger :: Integer -> Double Source #
Num Float # | Note that due to the presence of `NaN`, not all elements of `Float` have an additive inverse.
    >>> 0/0 + (negate 0/0 :: Float)
    NaN
Also note that due to the presence of -0, `Float`'s `Num` instance doesn't have an additive identity
    >>> 0 + (-0 :: Float)
    0.0
Since: base-2.1
Instance details Defined in GHC.Float Methods (+) :: Float -> Float -> Float Source # (-) :: Float -> Float -> Float Source # (*) :: Float -> Float -> Float Source # negate :: Float -> Float Source # abs :: Float -> Float Source # signum :: Float -> Float Source # fromInteger :: Integer -> Float Source #
Num Int # | Since: base-2.1
Instance details Defined in GHC.Num Methods (+) :: Int -> Int -> Int Source # (-) :: Int -> Int -> Int Source # (*) :: Int -> Int -> Int Source # negate :: Int -> Int Source # abs :: Int -> Int Source # signum :: Int -> Int Source # fromInteger :: Integer -> Int Source #
Num Int8 # | Since: base-2.1
Instance details Defined in GHC.Int Methods (+) :: Int8 -> Int8 -> Int8 Source # (-) :: Int8 -> Int8 -> Int8 Source # (*) :: Int8 -> Int8 -> Int8 Source # negate :: Int8 -> Int8 Source # abs :: Int8 -> Int8 Source # signum :: Int8 -> Int8 Source # fromInteger :: Integer -> Int8 Source #
Num Int16 # | Since: base-2.1
Instance details Defined in GHC.Int Methods (+) :: Int16 -> Int16 -> Int16 Source # (-) :: Int16 -> Int16 -> Int16 Source # (*) :: Int16 -> Int16 -> Int16 Source # negate :: Int16 -> Int16 Source # abs :: Int16 -> Int16 Source # signum :: Int16 -> Int16 Source # fromInteger :: Integer -> Int16 Source #
Num Int32 # | Since: base-2.1
Instance details Defined in GHC.Int Methods (+) :: Int32 -> Int32 -> Int32 Source # (-) :: Int32 -> Int32 -> Int32 Source # (*) :: Int32 -> Int32 -> Int32 Source # negate :: Int32 -> Int32 Source # abs :: Int32 -> Int32 Source # signum :: Int32 -> Int32 Source # fromInteger :: Integer -> Int32 Source #
Num Int64 # | Since: base-2.1
Instance details Defined in GHC.Int Methods (+) :: Int64 -> Int64 -> Int64 Source # (-) :: Int64 -> Int64 -> Int64 Source # (*) :: Int64 -> Int64 -> Int64 Source # negate :: Int64 -> Int64 Source # abs :: Int64 -> Int64 Source # signum :: Int64 -> Int64 Source # fromInteger :: Integer -> Int64 Source #
Num Integer # | Since: base-2.1
Instance details Defined in GHC.Num Methods (+) :: Integer -> Integer -> Integer Source # (-) :: Integer -> Integer -> Integer Source # (*) :: Integer -> Integer -> Integer Source # negate :: Integer -> Integer Source # abs :: Integer -> Integer Source # signum :: Integer -> Integer Source # fromInteger :: Integer -> Integer Source #
Num Natural # | Note that `Natural`'s `Num` instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though. Since: base-4.8.0.0
Instance details Defined in GHC.Num Methods (+) :: Natural -> Natural -> Natural Source # (-) :: Natural -> Natural -> Natural Source # (*) :: Natural -> Natural -> Natural Source # negate :: Natural -> Natural Source # abs :: Natural -> Natural Source # signum :: Natural -> Natural Source # fromInteger :: Integer -> Natural Source #
Num Word # | Since: base-2.1
Instance details Defined in GHC.Num Methods (+) :: Word -> Word -> Word Source # (-) :: Word -> Word -> Word Source # (*) :: Word -> Word -> Word Source # negate :: Word -> Word Source # abs :: Word -> Word Source # signum :: Word -> Word Source # fromInteger :: Integer -> Word Source #
Num Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word8 -> Word8 -> Word8 Source # (-) :: Word8 -> Word8 -> Word8 Source # (*) :: Word8 -> Word8 -> Word8 Source # negate :: Word8 -> Word8 Source # abs :: Word8 -> Word8 Source # signum :: Word8 -> Word8 Source # fromInteger :: Integer -> Word8 Source #
Num Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word16 -> Word16 -> Word16 Source # (-) :: Word16 -> Word16 -> Word16 Source # (*) :: Word16 -> Word16 -> Word16 Source # negate :: Word16 -> Word16 Source # abs :: Word16 -> Word16 Source # signum :: Word16 -> Word16 Source # fromInteger :: Integer -> Word16 Source #
Num Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word32 -> Word32 -> Word32 Source # (-) :: Word32 -> Word32 -> Word32 Source # (*) :: Word32 -> Word32 -> Word32 Source # negate :: Word32 -> Word32 Source # abs :: Word32 -> Word32 Source # signum :: Word32 -> Word32 Source # fromInteger :: Integer -> Word32 Source #
Num Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word64 -> Word64 -> Word64 Source # (-) :: Word64 -> Word64 -> Word64 Source # (*) :: Word64 -> Word64 -> Word64 Source # negate :: Word64 -> Word64 Source # abs :: Word64 -> Word64 Source # signum :: Word64 -> Word64 Source # fromInteger :: Integer -> Word64 Source #
Num IntPtr # |
Instance details Defined in Foreign.Ptr Methods (+) :: IntPtr -> IntPtr -> IntPtr Source # (-) :: IntPtr -> IntPtr -> IntPtr Source # (*) :: IntPtr -> IntPtr -> IntPtr Source # negate :: IntPtr -> IntPtr Source # abs :: IntPtr -> IntPtr Source # signum :: IntPtr -> IntPtr Source # fromInteger :: Integer -> IntPtr Source #
Num WordPtr # |
Instance details Defined in Foreign.Ptr Methods (+) :: WordPtr -> WordPtr -> WordPtr Source # (-) :: WordPtr -> WordPtr -> WordPtr Source # (*) :: WordPtr -> WordPtr -> WordPtr Source # negate :: WordPtr -> WordPtr Source # abs :: WordPtr -> WordPtr Source # signum :: WordPtr -> WordPtr Source # fromInteger :: Integer -> WordPtr Source #
Num CUIntMax # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUIntMax -> CUIntMax -> CUIntMax Source # (-) :: CUIntMax -> CUIntMax -> CUIntMax Source # (*) :: CUIntMax -> CUIntMax -> CUIntMax Source # negate :: CUIntMax -> CUIntMax Source # abs :: CUIntMax -> CUIntMax Source # signum :: CUIntMax -> CUIntMax Source # fromInteger :: Integer -> CUIntMax Source #
Num CIntMax # |
Instance details Defined in Foreign.C.Types Methods (+) :: CIntMax -> CIntMax -> CIntMax Source # (-) :: CIntMax -> CIntMax -> CIntMax Source # (*) :: CIntMax -> CIntMax -> CIntMax Source # negate :: CIntMax -> CIntMax Source # abs :: CIntMax -> CIntMax Source # signum :: CIntMax -> CIntMax Source # fromInteger :: Integer -> CIntMax Source #
Num CUIntPtr # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (-) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (*) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # negate :: CUIntPtr -> CUIntPtr Source # abs :: CUIntPtr -> CUIntPtr Source # signum :: CUIntPtr -> CUIntPtr Source # fromInteger :: Integer -> CUIntPtr Source #
Num CIntPtr # |
Instance details Defined in Foreign.C.Types Methods (+) :: CIntPtr -> CIntPtr -> CIntPtr Source # (-) :: CIntPtr -> CIntPtr -> CIntPtr Source # (*) :: CIntPtr -> CIntPtr -> CIntPtr Source # negate :: CIntPtr -> CIntPtr Source # abs :: CIntPtr -> CIntPtr Source # signum :: CIntPtr -> CIntPtr Source # fromInteger :: Integer -> CIntPtr Source #
Num CSUSeconds # |
Instance details Defined in Foreign.C.Types Methods (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # (-) :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # negate :: CSUSeconds -> CSUSeconds Source # abs :: CSUSeconds -> CSUSeconds Source # signum :: CSUSeconds -> CSUSeconds Source # fromInteger :: Integer -> CSUSeconds Source #
Num CUSeconds # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUSeconds -> CUSeconds -> CUSeconds Source # (-) :: CUSeconds -> CUSeconds -> CUSeconds Source # (*) :: CUSeconds -> CUSeconds -> CUSeconds Source # negate :: CUSeconds -> CUSeconds Source # abs :: CUSeconds -> CUSeconds Source # signum :: CUSeconds -> CUSeconds Source # fromInteger :: Integer -> CUSeconds Source #
Num CTime # |
Instance details Defined in Foreign.C.Types Methods (+) :: CTime -> CTime -> CTime Source # (-) :: CTime -> CTime -> CTime Source # (*) :: CTime -> CTime -> CTime Source # negate :: CTime -> CTime Source # abs :: CTime -> CTime Source # signum :: CTime -> CTime Source # fromInteger :: Integer -> CTime Source #
Num CClock # |
Instance details Defined in Foreign.C.Types Methods (+) :: CClock -> CClock -> CClock Source # (-) :: CClock -> CClock -> CClock Source # (*) :: CClock -> CClock -> CClock Source # negate :: CClock -> CClock Source # abs :: CClock -> CClock Source # signum :: CClock -> CClock Source # fromInteger :: Integer -> CClock Source #
Num CSigAtomic # |
Instance details Defined in Foreign.C.Types Methods (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # (-) :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # negate :: CSigAtomic -> CSigAtomic Source # abs :: CSigAtomic -> CSigAtomic Source # signum :: CSigAtomic -> CSigAtomic Source # fromInteger :: Integer -> CSigAtomic Source #
Num CWchar # |
Instance details Defined in Foreign.C.Types Methods (+) :: CWchar -> CWchar -> CWchar Source # (-) :: CWchar -> CWchar -> CWchar Source # (*) :: CWchar -> CWchar -> CWchar Source # negate :: CWchar -> CWchar Source # abs :: CWchar -> CWchar Source # signum :: CWchar -> CWchar Source # fromInteger :: Integer -> CWchar Source #
Num CSize # |
Instance details Defined in Foreign.C.Types Methods (+) :: CSize -> CSize -> CSize Source # (-) :: CSize -> CSize -> CSize Source # (*) :: CSize -> CSize -> CSize Source # negate :: CSize -> CSize Source # abs :: CSize -> CSize Source # signum :: CSize -> CSize Source # fromInteger :: Integer -> CSize Source #
Num CPtrdiff # |
Instance details Defined in Foreign.C.Types Methods (+) :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # (-) :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # (*) :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # negate :: CPtrdiff -> CPtrdiff Source # abs :: CPtrdiff -> CPtrdiff Source # signum :: CPtrdiff -> CPtrdiff Source # fromInteger :: Integer -> CPtrdiff Source #
Num CDouble # |
Instance details Defined in Foreign.C.Types Methods (+) :: CDouble -> CDouble -> CDouble Source # (-) :: CDouble -> CDouble -> CDouble Source # (*) :: CDouble -> CDouble -> CDouble Source # negate :: CDouble -> CDouble Source # abs :: CDouble -> CDouble Source # signum :: CDouble -> CDouble Source # fromInteger :: Integer -> CDouble Source #
Num CFloat # |
Instance details Defined in Foreign.C.Types Methods (+) :: CFloat -> CFloat -> CFloat Source # (-) :: CFloat -> CFloat -> CFloat Source # (*) :: CFloat -> CFloat -> CFloat Source # negate :: CFloat -> CFloat Source # abs :: CFloat -> CFloat Source # signum :: CFloat -> CFloat Source # fromInteger :: Integer -> CFloat Source #
Num CBool # |
Instance details Defined in Foreign.C.Types Methods (+) :: CBool -> CBool -> CBool Source # (-) :: CBool -> CBool -> CBool Source # (*) :: CBool -> CBool -> CBool Source # negate :: CBool -> CBool Source # abs :: CBool -> CBool Source # signum :: CBool -> CBool Source # fromInteger :: Integer -> CBool Source #
Num CULLong # |
Instance details Defined in Foreign.C.Types Methods (+) :: CULLong -> CULLong -> CULLong Source # (-) :: CULLong -> CULLong -> CULLong Source # (*) :: CULLong -> CULLong -> CULLong Source # negate :: CULLong -> CULLong Source # abs :: CULLong -> CULLong Source # signum :: CULLong -> CULLong Source # fromInteger :: Integer -> CULLong Source #
Num CLLong # |
Instance details Defined in Foreign.C.Types Methods (+) :: CLLong -> CLLong -> CLLong Source # (-) :: CLLong -> CLLong -> CLLong Source # (*) :: CLLong -> CLLong -> CLLong Source # negate :: CLLong -> CLLong Source # abs :: CLLong -> CLLong Source # signum :: CLLong -> CLLong Source # fromInteger :: Integer -> CLLong Source #
Num CULong # |
Instance details Defined in Foreign.C.Types Methods (+) :: CULong -> CULong -> CULong Source # (-) :: CULong -> CULong -> CULong Source # (*) :: CULong -> CULong -> CULong Source # negate :: CULong -> CULong Source # abs :: CULong -> CULong Source # signum :: CULong -> CULong Source # fromInteger :: Integer -> CULong Source #
Num CLong # |
Instance details Defined in Foreign.C.Types Methods (+) :: CLong -> CLong -> CLong Source # (-) :: CLong -> CLong -> CLong Source # (*) :: CLong -> CLong -> CLong Source # negate :: CLong -> CLong Source # abs :: CLong -> CLong Source # signum :: CLong -> CLong Source # fromInteger :: Integer -> CLong Source #
Num CUInt # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUInt -> CUInt -> CUInt Source # (-) :: CUInt -> CUInt -> CUInt Source # (*) :: CUInt -> CUInt -> CUInt Source # negate :: CUInt -> CUInt Source # abs :: CUInt -> CUInt Source # signum :: CUInt -> CUInt Source # fromInteger :: Integer -> CUInt Source #
Num CInt # |
Instance details Defined in Foreign.C.Types Methods (+) :: CInt -> CInt -> CInt Source # (-) :: CInt -> CInt -> CInt Source # (*) :: CInt -> CInt -> CInt Source # negate :: CInt -> CInt Source # abs :: CInt -> CInt Source # signum :: CInt -> CInt Source # fromInteger :: Integer -> CInt Source #
Num CUShort # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUShort -> CUShort -> CUShort Source # (-) :: CUShort -> CUShort -> CUShort Source # (*) :: CUShort -> CUShort -> CUShort Source # negate :: CUShort -> CUShort Source # abs :: CUShort -> CUShort Source # signum :: CUShort -> CUShort Source # fromInteger :: Integer -> CUShort Source #
Num CShort # |
Instance details Defined in Foreign.C.Types Methods (+) :: CShort -> CShort -> CShort Source # (-) :: CShort -> CShort -> CShort Source # (*) :: CShort -> CShort -> CShort Source # negate :: CShort -> CShort Source # abs :: CShort -> CShort Source # signum :: CShort -> CShort Source # fromInteger :: Integer -> CShort Source #
Num CUChar # |
Instance details Defined in Foreign.C.Types Methods (+) :: CUChar -> CUChar -> CUChar Source # (-) :: CUChar -> CUChar -> CUChar Source # (*) :: CUChar -> CUChar -> CUChar Source # negate :: CUChar -> CUChar Source # abs :: CUChar -> CUChar Source # signum :: CUChar -> CUChar Source # fromInteger :: Integer -> CUChar Source #
Num CSChar # |
Instance details Defined in Foreign.C.Types Methods (+) :: CSChar -> CSChar -> CSChar Source # (-) :: CSChar -> CSChar -> CSChar Source # (*) :: CSChar -> CSChar -> CSChar Source # negate :: CSChar -> CSChar Source # abs :: CSChar -> CSChar Source # signum :: CSChar -> CSChar Source # fromInteger :: Integer -> CSChar Source #
Num CChar # |
Instance details Defined in Foreign.C.Types Methods (+) :: CChar -> CChar -> CChar Source # (-) :: CChar -> CChar -> CChar Source # (*) :: CChar -> CChar -> CChar Source # negate :: CChar -> CChar Source # abs :: CChar -> CChar Source # signum :: CChar -> CChar Source # fromInteger :: Integer -> CChar Source #
Num Fd # |
Instance details Defined in System.Posix.Types Methods (+) :: Fd -> Fd -> Fd Source # (-) :: Fd -> Fd -> Fd Source # (*) :: Fd -> Fd -> Fd Source # negate :: Fd -> Fd Source # abs :: Fd -> Fd Source # signum :: Fd -> Fd Source # fromInteger :: Integer -> Fd Source #
Num CNfds # |
Instance details Defined in System.Posix.Types Methods (+) :: CNfds -> CNfds -> CNfds Source # (-) :: CNfds -> CNfds -> CNfds Source # (*) :: CNfds -> CNfds -> CNfds Source # negate :: CNfds -> CNfds Source # abs :: CNfds -> CNfds Source # signum :: CNfds -> CNfds Source # fromInteger :: Integer -> CNfds Source #
Num CSocklen # |
Instance details Defined in System.Posix.Types Methods (+) :: CSocklen -> CSocklen -> CSocklen Source # (-) :: CSocklen -> CSocklen -> CSocklen Source # (*) :: CSocklen -> CSocklen -> CSocklen Source # negate :: CSocklen -> CSocklen Source # abs :: CSocklen -> CSocklen Source # signum :: CSocklen -> CSocklen Source # fromInteger :: Integer -> CSocklen Source #
Num CKey # |
Instance details Defined in System.Posix.Types Methods (+) :: CKey -> CKey -> CKey Source # (-) :: CKey -> CKey -> CKey Source # (*) :: CKey -> CKey -> CKey Source # negate :: CKey -> CKey Source # abs :: CKey -> CKey Source # signum :: CKey -> CKey Source # fromInteger :: Integer -> CKey Source #
Num CId # |
Instance details Defined in System.Posix.Types Methods (+) :: CId -> CId -> CId Source # (-) :: CId -> CId -> CId Source # (*) :: CId -> CId -> CId Source # negate :: CId -> CId Source # abs :: CId -> CId Source # signum :: CId -> CId Source # fromInteger :: Integer -> CId Source #
Num CFsFilCnt # |
Instance details Defined in System.Posix.Types Methods (+) :: CFsFilCnt -> CFsFilCnt -> CFsFilCnt Source # (-) :: CFsFilCnt -> CFsFilCnt -> CFsFilCnt Source # (*) :: CFsFilCnt -> CFsFilCnt -> CFsFilCnt Source # negate :: CFsFilCnt -> CFsFilCnt Source # abs :: CFsFilCnt -> CFsFilCnt Source # signum :: CFsFilCnt -> CFsFilCnt Source # fromInteger :: Integer -> CFsFilCnt Source #
Num CFsBlkCnt # |
Instance details Defined in System.Posix.Types Methods (+) :: CFsBlkCnt -> CFsBlkCnt -> CFsBlkCnt Source # (-) :: CFsBlkCnt -> CFsBlkCnt -> CFsBlkCnt Source # (*) :: CFsBlkCnt -> CFsBlkCnt -> CFsBlkCnt Source # negate :: CFsBlkCnt -> CFsBlkCnt Source # abs :: CFsBlkCnt -> CFsBlkCnt Source # signum :: CFsBlkCnt -> CFsBlkCnt Source # fromInteger :: Integer -> CFsBlkCnt Source #
Num CClockId # |
Instance details Defined in System.Posix.Types Methods (+) :: CClockId -> CClockId -> CClockId Source # (-) :: CClockId -> CClockId -> CClockId Source # (*) :: CClockId -> CClockId -> CClockId Source # negate :: CClockId -> CClockId Source # abs :: CClockId -> CClockId Source # signum :: CClockId -> CClockId Source # fromInteger :: Integer -> CClockId Source #
Num CBlkCnt # |
Instance details Defined in System.Posix.Types Methods (+) :: CBlkCnt -> CBlkCnt -> CBlkCnt Source # (-) :: CBlkCnt -> CBlkCnt -> CBlkCnt Source # (*) :: CBlkCnt -> CBlkCnt -> CBlkCnt Source # negate :: CBlkCnt -> CBlkCnt Source # abs :: CBlkCnt -> CBlkCnt Source # signum :: CBlkCnt -> CBlkCnt Source # fromInteger :: Integer -> CBlkCnt Source #
Num CBlkSize # |
Instance details Defined in System.Posix.Types Methods (+) :: CBlkSize -> CBlkSize -> CBlkSize Source # (-) :: CBlkSize -> CBlkSize -> CBlkSize Source # (*) :: CBlkSize -> CBlkSize -> CBlkSize Source # negate :: CBlkSize -> CBlkSize Source # abs :: CBlkSize -> CBlkSize Source # signum :: CBlkSize -> CBlkSize Source # fromInteger :: Integer -> CBlkSize Source #
Num CRLim # |
Instance details Defined in System.Posix.Types Methods (+) :: CRLim -> CRLim -> CRLim Source # (-) :: CRLim -> CRLim -> CRLim Source # (*) :: CRLim -> CRLim -> CRLim Source # negate :: CRLim -> CRLim Source # abs :: CRLim -> CRLim Source # signum :: CRLim -> CRLim Source # fromInteger :: Integer -> CRLim Source #
Num CTcflag # |
Instance details Defined in System.Posix.Types Methods (+) :: CTcflag -> CTcflag -> CTcflag Source # (-) :: CTcflag -> CTcflag -> CTcflag Source # (*) :: CTcflag -> CTcflag -> CTcflag Source # negate :: CTcflag -> CTcflag Source # abs :: CTcflag -> CTcflag Source # signum :: CTcflag -> CTcflag Source # fromInteger :: Integer -> CTcflag Source #
Num CSpeed # |
Instance details Defined in System.Posix.Types Methods (+) :: CSpeed -> CSpeed -> CSpeed Source # (-) :: CSpeed -> CSpeed -> CSpeed Source # (*) :: CSpeed -> CSpeed -> CSpeed Source # negate :: CSpeed -> CSpeed Source # abs :: CSpeed -> CSpeed Source # signum :: CSpeed -> CSpeed Source # fromInteger :: Integer -> CSpeed Source #
Num CCc # |
Instance details Defined in System.Posix.Types Methods (+) :: CCc -> CCc -> CCc Source # (-) :: CCc -> CCc -> CCc Source # (*) :: CCc -> CCc -> CCc Source # negate :: CCc -> CCc Source # abs :: CCc -> CCc Source # signum :: CCc -> CCc Source # fromInteger :: Integer -> CCc Source #
Num CUid # |
Instance details Defined in System.Posix.Types Methods (+) :: CUid -> CUid -> CUid Source # (-) :: CUid -> CUid -> CUid Source # (*) :: CUid -> CUid -> CUid Source # negate :: CUid -> CUid Source # abs :: CUid -> CUid Source # signum :: CUid -> CUid Source # fromInteger :: Integer -> CUid Source #
Num CNlink # |
Instance details Defined in System.Posix.Types Methods (+) :: CNlink -> CNlink -> CNlink Source # (-) :: CNlink -> CNlink -> CNlink Source # (*) :: CNlink -> CNlink -> CNlink Source # negate :: CNlink -> CNlink Source # abs :: CNlink -> CNlink Source # signum :: CNlink -> CNlink Source # fromInteger :: Integer -> CNlink Source #
Num CGid # |
Instance details Defined in System.Posix.Types Methods (+) :: CGid -> CGid -> CGid Source # (-) :: CGid -> CGid -> CGid Source # (*) :: CGid -> CGid -> CGid Source # negate :: CGid -> CGid Source # abs :: CGid -> CGid Source # signum :: CGid -> CGid Source # fromInteger :: Integer -> CGid Source #
Num CSsize # |
Instance details Defined in System.Posix.Types Methods (+) :: CSsize -> CSsize -> CSsize Source # (-) :: CSsize -> CSsize -> CSsize Source # (*) :: CSsize -> CSsize -> CSsize Source # negate :: CSsize -> CSsize Source # abs :: CSsize -> CSsize Source # signum :: CSsize -> CSsize Source # fromInteger :: Integer -> CSsize Source #
Num CPid # |
Instance details Defined in System.Posix.Types Methods (+) :: CPid -> CPid -> CPid Source # (-) :: CPid -> CPid -> CPid Source # (*) :: CPid -> CPid -> CPid Source # negate :: CPid -> CPid Source # abs :: CPid -> CPid Source # signum :: CPid -> CPid Source # fromInteger :: Integer -> CPid Source #
Num COff # |
Instance details Defined in System.Posix.Types Methods (+) :: COff -> COff -> COff Source # (-) :: COff -> COff -> COff Source # (*) :: COff -> COff -> COff Source # negate :: COff -> COff Source # abs :: COff -> COff Source # signum :: COff -> COff Source # fromInteger :: Integer -> COff Source #
Num CMode # |
Instance details Defined in System.Posix.Types Methods (+) :: CMode -> CMode -> CMode Source # (-) :: CMode -> CMode -> CMode Source # (*) :: CMode -> CMode -> CMode Source # negate :: CMode -> CMode Source # abs :: CMode -> CMode Source # signum :: CMode -> CMode Source # fromInteger :: Integer -> CMode Source #
Num CIno # |
Instance details Defined in System.Posix.Types Methods (+) :: CIno -> CIno -> CIno Source # (-) :: CIno -> CIno -> CIno Source # (*) :: CIno -> CIno -> CIno Source # negate :: CIno -> CIno Source # abs :: CIno -> CIno Source # signum :: CIno -> CIno Source # fromInteger :: Integer -> CIno Source #
Num CDev # |
Instance details Defined in System.Posix.Types Methods (+) :: CDev -> CDev -> CDev Source # (-) :: CDev -> CDev -> CDev Source # (*) :: CDev -> CDev -> CDev Source # negate :: CDev -> CDev Source # abs :: CDev -> CDev Source # signum :: CDev -> CDev Source # fromInteger :: Integer -> CDev Source #
Integral a => Num (Ratio a) # | Since: base-2.0.1
Instance details Defined in GHC.Real Methods (+) :: Ratio a -> Ratio a -> Ratio a Source # (-) :: Ratio a -> Ratio a -> Ratio a Source # (*) :: Ratio a -> Ratio a -> Ratio a Source # negate :: Ratio a -> Ratio a Source # abs :: Ratio a -> Ratio a Source # signum :: Ratio a -> Ratio a Source # fromInteger :: Integer -> Ratio a Source #
Num a => Num (Down a) # | Since: base-4.11.0.0
Instance details Defined in Data.Ord Methods (+) :: Down a -> Down a -> Down a Source # (-) :: Down a -> Down a -> Down a Source # (*) :: Down a -> Down a -> Down a Source # negate :: Down a -> Down a Source # abs :: Down a -> Down a Source # signum :: Down a -> Down a Source # fromInteger :: Integer -> Down a Source #
Num a => Num (Product a) # | Since: base-4.7.0.0
Instance details Defined in Data.Semigroup.Internal Methods (+) :: Product a -> Product a -> Product a Source # (-) :: Product a -> Product a -> Product a Source # (*) :: Product a -> Product a -> Product a Source # negate :: Product a -> Product a Source # abs :: Product a -> Product a Source # signum :: Product a -> Product a Source # fromInteger :: Integer -> Product a Source #
Num a => Num (Sum a) # | Since: base-4.7.0.0
Instance details Defined in Data.Semigroup.Internal Methods (+) :: Sum a -> Sum a -> Sum a Source # (-) :: Sum a -> Sum a -> Sum a Source # (*) :: Sum a -> Sum a -> Sum a Source # negate :: Sum a -> Sum a Source # abs :: Sum a -> Sum a Source # signum :: Sum a -> Sum a Source # fromInteger :: Integer -> Sum a Source #
Num a => Num (Identity a) # | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods (+) :: Identity a -> Identity a -> Identity a Source # (-) :: Identity a -> Identity a -> Identity a Source # (*) :: Identity a -> Identity a -> Identity a Source # negate :: Identity a -> Identity a Source # abs :: Identity a -> Identity a Source # signum :: Identity a -> Identity a Source # fromInteger :: Integer -> Identity a Source #
Num a => Num (Max a) # | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods (+) :: Max a -> Max a -> Max a Source # (-) :: Max a -> Max a -> Max a Source # (*) :: Max a -> Max a -> Max a Source # negate :: Max a -> Max a Source # abs :: Max a -> Max a Source # signum :: Max a -> Max a Source # fromInteger :: Integer -> Max a Source #
Num a => Num (Min a) # | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods (+) :: Min a -> Min a -> Min a Source # (-) :: Min a -> Min a -> Min a Source # (*) :: Min a -> Min a -> Min a Source # negate :: Min a -> Min a Source # abs :: Min a -> Min a Source # signum :: Min a -> Min a Source # fromInteger :: Integer -> Min a Source #
RealFloat a => Num (Complex a) # | Since: base-2.1
Instance details Defined in Data.Complex Methods (+) :: Complex a -> Complex a -> Complex a Source # (-) :: Complex a -> Complex a -> Complex a Source # (*) :: Complex a -> Complex a -> Complex a Source # negate :: Complex a -> Complex a Source # abs :: Complex a -> Complex a Source # signum :: Complex a -> Complex a Source # fromInteger :: Integer -> Complex a Source #
Num a => Num (Op a b) # |
Instance details Defined in Data.Functor.Contravariant Methods (+) :: Op a b -> Op a b -> Op a b Source # (-) :: Op a b -> Op a b -> Op a b Source # (*) :: Op a b -> Op a b -> Op a b Source # negate :: Op a b -> Op a b Source # abs :: Op a b -> Op a b Source # signum :: Op a b -> Op a b Source # fromInteger :: Integer -> Op a b Source #
HasResolution a => Num (Fixed a) # | Since: base-2.1
Instance details Defined in Data.Fixed Methods (+) :: Fixed a -> Fixed a -> Fixed a Source # (-) :: Fixed a -> Fixed a -> Fixed a Source # (*) :: Fixed a -> Fixed a -> Fixed a Source # negate :: Fixed a -> Fixed a Source # abs :: Fixed a -> Fixed a Source # signum :: Fixed a -> Fixed a Source # fromInteger :: Integer -> Fixed a Source #
Num (f a) => Num (Alt f a) # | Since: base-4.8.0.0
Instance details Defined in Data.Semigroup.Internal Methods (+) :: Alt f a -> Alt f a -> Alt f a Source # (-) :: Alt f a -> Alt f a -> Alt f a Source # (*) :: Alt f a -> Alt f a -> Alt f a Source # negate :: Alt f a -> Alt f a Source # abs :: Alt f a -> Alt f a Source # signum :: Alt f a -> Alt f a Source # fromInteger :: Integer -> Alt f a Source #
(Applicative f, Num a) => Num (Ap f a) # | Note that even if the underlying `Num` and `Applicative` instances are lawful, for most `Applicative`s, this instance will not be lawful. If you use this instance with the list `Applicative`, the following customary laws will not hold: Commutativity:
    >>> Ap [10,20] + Ap [1,2]
    Ap {getAp = [11,12,21,22]}
    >>> Ap [1,2] + Ap [10,20]
    Ap {getAp = [11,21,12,22]}
Additive inverse:
    >>> Ap [] + negate (Ap [])
    Ap {getAp = []}
    >>> fromInteger 0 :: Ap [] Int
    Ap {getAp = [0]}
Distributivity:
    >>> Ap [1,2] * (3 + 4)
    Ap {getAp = [7,14]}
    >>> (Ap [1,2] * 3) + (Ap [1,2] * 4)
    Ap {getAp = [7,11,10,14]}
Since: base-4.12.0.0
Instance details Defined in Data.Monoid Methods (+) :: Ap f a -> Ap f a -> Ap f a Source # (-) :: Ap f a -> Ap f a -> Ap f a Source # (*) :: Ap f a -> Ap f a -> Ap f a Source # negate :: Ap f a -> Ap f a Source # abs :: Ap f a -> Ap f a Source # signum :: Ap f a -> Ap f a Source # fromInteger :: Integer -> Ap f a Source #
Num a => Num (Const a b) # | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Const Methods (+) :: Const a b -> Const a b -> Const a b Source # (-) :: Const a b -> Const a b -> Const a b Source # (*) :: Const a b -> Const a b -> Const a b Source # negate :: Const a b -> Const a b Source # abs :: Const a b -> Const a b Source # signum :: Const a b -> Const a b Source # fromInteger :: Integer -> Const a b Source #

subtract :: Num a => a -> a -> a Source #

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.

quotRemInteger :: Integer -> Integer -> (# Integer, Integer #) Source #

Deprecated: Use integerQuotRem# instead

module GHC.Num.Integer

module GHC.Num.Natural

module GHC.Natural

module GHC.Integer