foundation-0.0.23: Alternative prelude with batteries and no dependencies

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Foundation.Numerical

Description

Compared to the Haskell hierarchy of number classes this provide a more flexible approach that is closer to the mathematical foundation (group, field, etc)

This try to only provide one feature per class, at the expense of the number of classes.

Synopsis

- class (Integral a, Eq a, Ord a) => IsIntegral a where
  - toInteger :: a -> Integer
- class IsIntegral a => IsNatural a where
  - toNatural :: a -> Natural
- class Signed a where
  - abs :: a -> a
  - signum :: a -> Sign
- class Additive a where
  - azero :: a
  - (+) :: a -> a -> a
  - scale :: IsNatural n => n -> a -> a
- class Subtractive a where
  - type Difference a :: Type
  - (-) :: a -> a -> Difference a
- class Multiplicative a where
  - midentity :: a
  - (*) :: a -> a -> a
  - (^) :: (IsNatural n, Enum n, IDivisible n) => a -> n -> a
- class (Additive a, Multiplicative a) => IDivisible a where
  - div :: a -> a -> a
  - mod :: a -> a -> a
  - divMod :: a -> a -> (a, a)
- class Multiplicative a => Divisible a where
  - (/) :: a -> a -> a
- data Sign
  - = SignNegative
  - | SignZero
  - | SignPositive
- recip :: Divisible a => a -> a
- class IntegralRounding a where
  - roundUp :: Integral n => a -> n
  - roundDown :: Integral n => a -> n
  - roundTruncate :: Integral n => a -> n
  - roundNearest :: Integral n => a -> n
- class FloatingPoint a where
  - floatRadix :: Proxy a -> Integer
  - floatDigits :: Proxy a -> Int
  - floatRange :: Proxy a -> (Int, Int)
  - floatDecode :: a -> (Integer, Int)
  - floatEncode :: Integer -> Int -> a

# Documentation

class (Integral a, Eq a, Ord a) => IsIntegral a where Source #

Number literals, convertible through the generic Integer type.

all number are Enum'erable, meaning that you can move to next element

Methods

toInteger :: a -> Integer Source #

Instances

IsIntegral Int |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int -> Integer Source #
IsIntegral Int8 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int8 -> Integer Source #
IsIntegral Int16 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int16 -> Integer Source #
IsIntegral Int32 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int32 -> Integer Source #
IsIntegral Int64 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int64 -> Integer Source #
IsIntegral Integer |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Integer -> Integer Source #
IsIntegral Natural |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Natural -> Integer Source #
IsIntegral Word |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word -> Integer Source #
IsIntegral Word8 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word8 -> Integer Source #
IsIntegral Word16 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word16 -> Integer Source #
IsIntegral Word32 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word32 -> Integer Source #
IsIntegral Word64 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word64 -> Integer Source #
IsIntegral CChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CChar -> Integer Source #
IsIntegral CSChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSChar -> Integer Source #
IsIntegral CUChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUChar -> Integer Source #
IsIntegral CShort |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CShort -> Integer Source #
IsIntegral CUShort |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUShort -> Integer Source #
IsIntegral CInt |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CInt -> Integer Source #
IsIntegral CUInt |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUInt -> Integer Source #
IsIntegral CLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CLong -> Integer Source #
IsIntegral CULong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CULong -> Integer Source #
IsIntegral CLLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CLLong -> Integer Source #
IsIntegral CULLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CULLong -> Integer Source #
IsIntegral CBool |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CBool -> Integer Source #
IsIntegral CPtrdiff |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CPtrdiff -> Integer Source #
IsIntegral CSize |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSize -> Integer Source #
IsIntegral CWchar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CWchar -> Integer Source #
IsIntegral CSigAtomic |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSigAtomic -> Integer Source #
IsIntegral CIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CIntPtr -> Integer Source #
IsIntegral CUIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUIntPtr -> Integer Source #
IsIntegral CIntMax |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CIntMax -> Integer Source #
IsIntegral CUIntMax |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUIntMax -> Integer Source #
IsIntegral Word256 |
Instance details Defined in Basement.Types.Word256 Methods toInteger :: Word256 -> Integer Source #
IsIntegral Word128 |
Instance details Defined in Basement.Types.Word128 Methods toInteger :: Word128 -> Integer Source #
IsIntegral (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toInteger :: Offset ty -> Integer Source #
IsIntegral (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toInteger :: CountOf ty -> Integer Source #
(KnownNat n, NatWithinBound Word64 n) => IsIntegral (Zn64 n) |
Instance details Defined in Basement.Bounded Methods toInteger :: Zn64 n -> Integer Source #
KnownNat n => IsIntegral (Zn n) |
Instance details Defined in Basement.Bounded Methods toInteger :: Zn n -> Integer Source #

class IsIntegral a => IsNatural a where Source #

Non Negative Number literals, convertible through the generic Natural type

Methods

toNatural :: a -> Natural Source #

Instances

IsNatural Natural |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Natural -> Natural Source #
IsNatural Word |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word -> Natural Source #
IsNatural Word8 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word8 -> Natural Source #
IsNatural Word16 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word16 -> Natural Source #
IsNatural Word32 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word32 -> Natural Source #
IsNatural Word64 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word64 -> Natural Source #
IsNatural CUChar |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUChar -> Natural Source #
IsNatural CUShort |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUShort -> Natural Source #
IsNatural CUInt |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUInt -> Natural Source #
IsNatural CULong |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CULong -> Natural Source #
IsNatural CULLong |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CULLong -> Natural Source #
IsNatural CSize |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CSize -> Natural Source #
IsNatural CUIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUIntPtr -> Natural Source #
IsNatural CUIntMax |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUIntMax -> Natural Source #
IsNatural Word256 |
Instance details Defined in Basement.Types.Word256 Methods toNatural :: Word256 -> Natural Source #
IsNatural Word128 |
Instance details Defined in Basement.Types.Word128 Methods toNatural :: Word128 -> Natural Source #
IsNatural (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toNatural :: Offset ty -> Natural Source #
IsNatural (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toNatural :: CountOf ty -> Natural Source #
(KnownNat n, NatWithinBound Word64 n) => IsNatural (Zn64 n) |
Instance details Defined in Basement.Bounded Methods toNatural :: Zn64 n -> Natural Source #
KnownNat n => IsNatural (Zn n) |
Instance details Defined in Basement.Bounded Methods toNatural :: Zn n -> Natural Source #

class Signed a where Source #

types that have sign and can be made absolute

Methods

abs :: a -> a Source #

signum :: a -> Sign Source #

Instances

Signed Double Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Double -> Double Source # signum :: Double -> Sign Source #
Signed Float Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Float -> Float Source # signum :: Float -> Sign Source #
Signed Int Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Int -> Int Source # signum :: Int -> Sign Source #
Signed Int8 Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Int8 -> Int8 Source # signum :: Int8 -> Sign Source #
Signed Int16 Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Int16 -> Int16 Source # signum :: Int16 -> Sign Source #
Signed Int32 Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Int32 -> Int32 Source # signum :: Int32 -> Sign Source #
Signed Int64 Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Int64 -> Int64 Source # signum :: Int64 -> Sign Source #
Signed Integer Source # |
Instance details Defined in Foundation.Numerical Methods abs :: Integer -> Integer Source # signum :: Integer -> Sign Source #

class Additive a where Source #

Represent class of things that can be added together, contains a neutral element and is commutative.

    x + azero = x
    azero + x = x
    x + y = y + x

Minimal complete definition

azero, (+)

Methods

azero :: a Source #

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

scale :: IsNatural n => n -> a -> a Source #

Instances

Additive Double |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Double Source # (+) :: Double -> Double -> Double Source # scale :: IsNatural n => n -> Double -> Double Source #
Additive Float |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Float Source # (+) :: Float -> Float -> Float Source # scale :: IsNatural n => n -> Float -> Float Source #
Additive Int |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int Source # (+) :: Int -> Int -> Int Source # scale :: IsNatural n => n -> Int -> Int Source #
Additive Int8 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int8 Source # (+) :: Int8 -> Int8 -> Int8 Source # scale :: IsNatural n => n -> Int8 -> Int8 Source #
Additive Int16 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int16 Source # (+) :: Int16 -> Int16 -> Int16 Source # scale :: IsNatural n => n -> Int16 -> Int16 Source #
Additive Int32 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int32 Source # (+) :: Int32 -> Int32 -> Int32 Source # scale :: IsNatural n => n -> Int32 -> Int32 Source #
Additive Int64 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int64 Source # (+) :: Int64 -> Int64 -> Int64 Source # scale :: IsNatural n => n -> Int64 -> Int64 Source #
Additive Integer |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Integer Source # (+) :: Integer -> Integer -> Integer Source # scale :: IsNatural n => n -> Integer -> Integer Source #
Additive Natural |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Natural Source # (+) :: Natural -> Natural -> Natural Source # scale :: IsNatural n => n -> Natural -> Natural Source #
Additive Word |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word Source # (+) :: Word -> Word -> Word Source # scale :: IsNatural n => n -> Word -> Word Source #
Additive Word8 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word8 Source # (+) :: Word8 -> Word8 -> Word8 Source # scale :: IsNatural n => n -> Word8 -> Word8 Source #
Additive Word16 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word16 Source # (+) :: Word16 -> Word16 -> Word16 Source # scale :: IsNatural n => n -> Word16 -> Word16 Source #
Additive Word32 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word32 Source # (+) :: Word32 -> Word32 -> Word32 Source # scale :: IsNatural n => n -> Word32 -> Word32 Source #
Additive Word64 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word64 Source # (+) :: Word64 -> Word64 -> Word64 Source # scale :: IsNatural n => n -> Word64 -> Word64 Source #
Additive COff |
Instance details Defined in Basement.Numerical.Additive Methods azero :: COff Source # (+) :: COff -> COff -> COff Source # scale :: IsNatural n => n -> COff -> COff Source #
Additive CChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CChar Source # (+) :: CChar -> CChar -> CChar Source # scale :: IsNatural n => n -> CChar -> CChar Source #
Additive CSChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSChar Source # (+) :: CSChar -> CSChar -> CSChar Source # scale :: IsNatural n => n -> CSChar -> CSChar Source #
Additive CUChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUChar Source # (+) :: CUChar -> CUChar -> CUChar Source # scale :: IsNatural n => n -> CUChar -> CUChar Source #
Additive CShort |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CShort Source # (+) :: CShort -> CShort -> CShort Source # scale :: IsNatural n => n -> CShort -> CShort Source #
Additive CUShort |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUShort Source # (+) :: CUShort -> CUShort -> CUShort Source # scale :: IsNatural n => n -> CUShort -> CUShort Source #
Additive CInt |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CInt Source # (+) :: CInt -> CInt -> CInt Source # scale :: IsNatural n => n -> CInt -> CInt Source #
Additive CUInt |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUInt Source # (+) :: CUInt -> CUInt -> CUInt Source # scale :: IsNatural n => n -> CUInt -> CUInt Source #
Additive CLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CLong Source # (+) :: CLong -> CLong -> CLong Source # scale :: IsNatural n => n -> CLong -> CLong Source #
Additive CULong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CULong Source # (+) :: CULong -> CULong -> CULong Source # scale :: IsNatural n => n -> CULong -> CULong Source #
Additive CLLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CLLong Source # (+) :: CLLong -> CLLong -> CLLong Source # scale :: IsNatural n => n -> CLLong -> CLLong Source #
Additive CULLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CULLong Source # (+) :: CULLong -> CULLong -> CULLong Source # scale :: IsNatural n => n -> CULLong -> CULLong Source #
Additive CFloat |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CFloat Source # (+) :: CFloat -> CFloat -> CFloat Source # scale :: IsNatural n => n -> CFloat -> CFloat Source #
Additive CDouble |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CDouble Source # (+) :: CDouble -> CDouble -> CDouble Source # scale :: IsNatural n => n -> CDouble -> CDouble Source #
Additive CPtrdiff |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CPtrdiff Source # (+) :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # scale :: IsNatural n => n -> CPtrdiff -> CPtrdiff Source #
Additive CSize |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSize Source # (+) :: CSize -> CSize -> CSize Source # scale :: IsNatural n => n -> CSize -> CSize Source #
Additive CWchar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CWchar Source # (+) :: CWchar -> CWchar -> CWchar Source # scale :: IsNatural n => n -> CWchar -> CWchar Source #
Additive CSigAtomic |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSigAtomic Source # (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # scale :: IsNatural n => n -> CSigAtomic -> CSigAtomic Source #
Additive CClock |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CClock Source # (+) :: CClock -> CClock -> CClock Source # scale :: IsNatural n => n -> CClock -> CClock Source #
Additive CTime |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CTime Source # (+) :: CTime -> CTime -> CTime Source # scale :: IsNatural n => n -> CTime -> CTime Source #
Additive CUSeconds |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUSeconds Source # (+) :: CUSeconds -> CUSeconds -> CUSeconds Source # scale :: IsNatural n => n -> CUSeconds -> CUSeconds Source #
Additive CSUSeconds |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSUSeconds Source # (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # scale :: IsNatural n => n -> CSUSeconds -> CSUSeconds Source #
Additive CIntPtr |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CIntPtr Source # (+) :: CIntPtr -> CIntPtr -> CIntPtr Source # scale :: IsNatural n => n -> CIntPtr -> CIntPtr Source #
Additive CUIntPtr |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUIntPtr Source # (+) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # scale :: IsNatural n => n -> CUIntPtr -> CUIntPtr Source #
Additive CIntMax |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CIntMax Source # (+) :: CIntMax -> CIntMax -> CIntMax Source # scale :: IsNatural n => n -> CIntMax -> CIntMax Source #
Additive CUIntMax |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUIntMax Source # (+) :: CUIntMax -> CUIntMax -> CUIntMax Source # scale :: IsNatural n => n -> CUIntMax -> CUIntMax Source #
Additive Word256 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word256 Source # (+) :: Word256 -> Word256 -> Word256 Source # scale :: IsNatural n => n -> Word256 -> Word256 Source #
Additive Word128 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word128 Source # (+) :: Word128 -> Word128 -> Word128 Source # scale :: IsNatural n => n -> Word128 -> Word128 Source #
Additive Seconds Source # |
Instance details Defined in Foundation.Time.Types Methods azero :: Seconds Source # (+) :: Seconds -> Seconds -> Seconds Source # scale :: IsNatural n => n -> Seconds -> Seconds Source #
Additive NanoSeconds Source # |
Instance details Defined in Foundation.Time.Types Methods azero :: NanoSeconds Source # (+) :: NanoSeconds -> NanoSeconds -> NanoSeconds Source # scale :: IsNatural n => n -> NanoSeconds -> NanoSeconds Source #
SizeValid n => Additive (Bits n) |
Instance details Defined in Basement.Bits Methods azero :: Bits n Source # (+) :: Bits n -> Bits n -> Bits n Source # scale :: IsNatural n0 => n0 -> Bits n -> Bits n Source #
Additive (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods azero :: Offset ty Source # (+) :: Offset ty -> Offset ty -> Offset ty Source # scale :: IsNatural n => n -> Offset ty -> Offset ty Source #
Additive (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods azero :: CountOf ty Source # (+) :: CountOf ty -> CountOf ty -> CountOf ty Source # scale :: IsNatural n => n -> CountOf ty -> CountOf ty Source #
(KnownNat n, NatWithinBound Word64 n) => Additive (Zn64 n) |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Zn64 n Source # (+) :: Zn64 n -> Zn64 n -> Zn64 n Source # scale :: IsNatural n0 => n0 -> Zn64 n -> Zn64 n Source #
KnownNat n => Additive (Zn n) |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Zn n Source # (+) :: Zn n -> Zn n -> Zn n Source # scale :: IsNatural n0 => n0 -> Zn n -> Zn n Source #

class Subtractive a where Source #

Represent class of things that can be subtracted.

Note that the result is not necessary of the same type as the operand depending on the actual type.

For example:

    (-) :: Int -> Int -> Int
    (-) :: DateTime -> DateTime -> Seconds
    (-) :: Ptr a -> Ptr a -> PtrDiff
    (-) :: Natural -> Natural -> Maybe Natural

Associated Types

type Difference a :: Type Source #

Methods

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

Instances

Subtractive Char |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Char :: Type Source # Methods (-) :: Char -> Char -> Difference Char Source #
Subtractive Double |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Double :: Type Source # Methods (-) :: Double -> Double -> Difference Double Source #
Subtractive Float |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Float :: Type Source # Methods (-) :: Float -> Float -> Difference Float Source #
Subtractive Int |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Int :: Type Source # Methods (-) :: Int -> Int -> Difference Int Source #
Subtractive Int8 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Int8 :: Type Source # Methods (-) :: Int8 -> Int8 -> Difference Int8 Source #
Subtractive Int16 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Int16 :: Type Source # Methods (-) :: Int16 -> Int16 -> Difference Int16 Source #
Subtractive Int32 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Int32 :: Type Source # Methods (-) :: Int32 -> Int32 -> Difference Int32 Source #
Subtractive Int64 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Int64 :: Type Source # Methods (-) :: Int64 -> Int64 -> Difference Int64 Source #
Subtractive Integer |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Integer :: Type Source # Methods (-) :: Integer -> Integer -> Difference Integer Source #
Subtractive Natural |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Natural :: Type Source # Methods (-) :: Natural -> Natural -> Difference Natural Source #
Subtractive Word |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word :: Type Source # Methods (-) :: Word -> Word -> Difference Word Source #
Subtractive Word8 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word8 :: Type Source # Methods (-) :: Word8 -> Word8 -> Difference Word8 Source #
Subtractive Word16 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word16 :: Type Source # Methods (-) :: Word16 -> Word16 -> Difference Word16 Source #
Subtractive Word32 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word32 :: Type Source # Methods (-) :: Word32 -> Word32 -> Difference Word32 Source #
Subtractive Word64 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word64 :: Type Source # Methods (-) :: Word64 -> Word64 -> Difference Word64 Source #
Subtractive COff |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference COff :: Type Source # Methods (-) :: COff -> COff -> Difference COff Source #
Subtractive CChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CChar :: Type Source # Methods (-) :: CChar -> CChar -> Difference CChar Source #
Subtractive CSChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CSChar :: Type Source # Methods (-) :: CSChar -> CSChar -> Difference CSChar Source #
Subtractive CUChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUChar :: Type Source # Methods (-) :: CUChar -> CUChar -> Difference CUChar Source #
Subtractive CShort |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CShort :: Type Source # Methods (-) :: CShort -> CShort -> Difference CShort Source #
Subtractive CUShort |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUShort :: Type Source # Methods (-) :: CUShort -> CUShort -> Difference CUShort Source #
Subtractive CInt |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CInt :: Type Source # Methods (-) :: CInt -> CInt -> Difference CInt Source #
Subtractive CUInt |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUInt :: Type Source # Methods (-) :: CUInt -> CUInt -> Difference CUInt Source #
Subtractive CLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CLong :: Type Source # Methods (-) :: CLong -> CLong -> Difference CLong Source #
Subtractive CULong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CULong :: Type Source # Methods (-) :: CULong -> CULong -> Difference CULong Source #
Subtractive CLLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CLLong :: Type Source # Methods (-) :: CLLong -> CLLong -> Difference CLLong Source #
Subtractive CULLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CULLong :: Type Source # Methods (-) :: CULLong -> CULLong -> Difference CULLong Source #
Subtractive CBool |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CBool :: Type Source # Methods (-) :: CBool -> CBool -> Difference CBool Source #
Subtractive CFloat |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CFloat :: Type Source # Methods (-) :: CFloat -> CFloat -> Difference CFloat Source #
Subtractive CDouble |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CDouble :: Type Source # Methods (-) :: CDouble -> CDouble -> Difference CDouble Source #
Subtractive CPtrdiff |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CPtrdiff :: Type Source # Methods (-) :: CPtrdiff -> CPtrdiff -> Difference CPtrdiff Source #
Subtractive CSize |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CSize :: Type Source # Methods (-) :: CSize -> CSize -> Difference CSize Source #
Subtractive CWchar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CWchar :: Type Source # Methods (-) :: CWchar -> CWchar -> Difference CWchar Source #
Subtractive CSigAtomic |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CSigAtomic :: Type Source # Methods (-) :: CSigAtomic -> CSigAtomic -> Difference CSigAtomic Source #
Subtractive CClock |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CClock :: Type Source # Methods (-) :: CClock -> CClock -> Difference CClock Source #
Subtractive CTime |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CTime :: Type Source # Methods (-) :: CTime -> CTime -> Difference CTime Source #
Subtractive CUSeconds |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUSeconds :: Type Source # Methods (-) :: CUSeconds -> CUSeconds -> Difference CUSeconds Source #
Subtractive CSUSeconds |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CSUSeconds :: Type Source # Methods (-) :: CSUSeconds -> CSUSeconds -> Difference CSUSeconds Source #
Subtractive CIntPtr |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CIntPtr :: Type Source # Methods (-) :: CIntPtr -> CIntPtr -> Difference CIntPtr Source #
Subtractive CUIntPtr |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUIntPtr :: Type Source # Methods (-) :: CUIntPtr -> CUIntPtr -> Difference CUIntPtr Source #
Subtractive CIntMax |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CIntMax :: Type Source # Methods (-) :: CIntMax -> CIntMax -> Difference CIntMax Source #
Subtractive CUIntMax |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference CUIntMax :: Type Source # Methods (-) :: CUIntMax -> CUIntMax -> Difference CUIntMax Source #
Subtractive Word256 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word256 :: Type Source # Methods (-) :: Word256 -> Word256 -> Difference Word256 Source #
Subtractive Word128 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference Word128 :: Type Source # Methods (-) :: Word128 -> Word128 -> Difference Word128 Source #
SizeValid n => Subtractive (Bits n) |
Instance details Defined in Basement.Bits Associated Types type Difference (Bits n) :: Type Source # Methods (-) :: Bits n -> Bits n -> Difference (Bits n) Source #
Subtractive (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Associated Types type Difference (Offset ty) :: Type Source # Methods (-) :: Offset ty -> Offset ty -> Difference (Offset ty) Source #
Subtractive (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Associated Types type Difference (CountOf ty) :: Type Source # Methods (-) :: CountOf ty -> CountOf ty -> Difference (CountOf ty) Source #
(KnownNat n, NatWithinBound Word64 n) => Subtractive (Zn64 n) |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference (Zn64 n) :: Type Source # Methods (-) :: Zn64 n -> Zn64 n -> Difference (Zn64 n) Source #
KnownNat n => Subtractive (Zn n) |
Instance details Defined in Basement.Numerical.Subtractive Associated Types type Difference (Zn n) :: Type Source # Methods (-) :: Zn n -> Zn n -> Difference (Zn n) Source #

class Multiplicative a where Source #

Represent class of things that can be multiplied together

    x * midentity = x
    midentity * x = x

Minimal complete definition

midentity, (*)

Methods

midentity :: a Source #

Identity element over multiplication

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

Multiplication of 2 elements that result in another element

(^) :: (IsNatural n, Enum n, IDivisible n) => a -> n -> a infixr 8 Source #

Raise to power, repeated multiplication e.g. > a ^ 2 = a * a > a ^ 10 = (a ^ 5) * (a ^ 5) .. (^) :: (IsNatural n) => a -> n -> a

Instances

Multiplicative Double |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Double Source # (*) :: Double -> Double -> Double Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Double -> n -> Double Source #
Multiplicative Float |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Float Source # (*) :: Float -> Float -> Float Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Float -> n -> Float Source #
Multiplicative Int |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int Source # (*) :: Int -> Int -> Int Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Int -> n -> Int Source #
Multiplicative Int8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int8 Source # (*) :: Int8 -> Int8 -> Int8 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Int8 -> n -> Int8 Source #
Multiplicative Int16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int16 Source # (*) :: Int16 -> Int16 -> Int16 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Int16 -> n -> Int16 Source #
Multiplicative Int32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int32 Source # (*) :: Int32 -> Int32 -> Int32 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Int32 -> n -> Int32 Source #
Multiplicative Int64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int64 Source # (*) :: Int64 -> Int64 -> Int64 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Int64 -> n -> Int64 Source #
Multiplicative Integer |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Integer Source # (*) :: Integer -> Integer -> Integer Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Integer -> n -> Integer Source #
Multiplicative Natural |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Natural Source # (*) :: Natural -> Natural -> Natural Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Natural -> n -> Natural Source #
Multiplicative Rational |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Rational Source # (*) :: Rational -> Rational -> Rational Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Rational -> n -> Rational Source #
Multiplicative Word |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word Source # (*) :: Word -> Word -> Word Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word -> n -> Word Source #
Multiplicative Word8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word8 Source # (*) :: Word8 -> Word8 -> Word8 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word8 -> n -> Word8 Source #
Multiplicative Word16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word16 Source # (*) :: Word16 -> Word16 -> Word16 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word16 -> n -> Word16 Source #
Multiplicative Word32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word32 Source # (*) :: Word32 -> Word32 -> Word32 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word32 -> n -> Word32 Source #
Multiplicative Word64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word64 Source # (*) :: Word64 -> Word64 -> Word64 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word64 -> n -> Word64 Source #
Multiplicative COff |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: COff Source # (*) :: COff -> COff -> COff Source # (^) :: (IsNatural n, Enum n, IDivisible n) => COff -> n -> COff Source #
Multiplicative CChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CChar Source # (*) :: CChar -> CChar -> CChar Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CChar -> n -> CChar Source #
Multiplicative CSChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSChar Source # (*) :: CSChar -> CSChar -> CSChar Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CSChar -> n -> CSChar Source #
Multiplicative CUChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUChar Source # (*) :: CUChar -> CUChar -> CUChar Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUChar -> n -> CUChar Source #
Multiplicative CShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CShort Source # (*) :: CShort -> CShort -> CShort Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CShort -> n -> CShort Source #
Multiplicative CUShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUShort Source # (*) :: CUShort -> CUShort -> CUShort Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUShort -> n -> CUShort Source #
Multiplicative CInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CInt Source # (*) :: CInt -> CInt -> CInt Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CInt -> n -> CInt Source #
Multiplicative CUInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUInt Source # (*) :: CUInt -> CUInt -> CUInt Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUInt -> n -> CUInt Source #
Multiplicative CLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CLong Source # (*) :: CLong -> CLong -> CLong Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CLong -> n -> CLong Source #
Multiplicative CULong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CULong Source # (*) :: CULong -> CULong -> CULong Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CULong -> n -> CULong Source #
Multiplicative CLLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CLLong Source # (*) :: CLLong -> CLLong -> CLLong Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CLLong -> n -> CLLong Source #
Multiplicative CULLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CULLong Source # (*) :: CULLong -> CULLong -> CULLong Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CULLong -> n -> CULLong Source #
Multiplicative CFloat |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CFloat Source # (*) :: CFloat -> CFloat -> CFloat Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CFloat -> n -> CFloat Source #
Multiplicative CDouble |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CDouble Source # (*) :: CDouble -> CDouble -> CDouble Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CDouble -> n -> CDouble Source #
Multiplicative CPtrdiff |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CPtrdiff Source # (*) :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CPtrdiff -> n -> CPtrdiff Source #
Multiplicative CSize |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSize Source # (*) :: CSize -> CSize -> CSize Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CSize -> n -> CSize Source #
Multiplicative CWchar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CWchar Source # (*) :: CWchar -> CWchar -> CWchar Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CWchar -> n -> CWchar Source #
Multiplicative CSigAtomic |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSigAtomic Source # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CSigAtomic -> n -> CSigAtomic Source #
Multiplicative CClock |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CClock Source # (*) :: CClock -> CClock -> CClock Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CClock -> n -> CClock Source #
Multiplicative CTime |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CTime Source # (*) :: CTime -> CTime -> CTime Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CTime -> n -> CTime Source #
Multiplicative CUSeconds |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUSeconds Source # (*) :: CUSeconds -> CUSeconds -> CUSeconds Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUSeconds -> n -> CUSeconds Source #
Multiplicative CSUSeconds |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSUSeconds Source # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CSUSeconds -> n -> CSUSeconds Source #
Multiplicative CIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CIntPtr Source # (*) :: CIntPtr -> CIntPtr -> CIntPtr Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CIntPtr -> n -> CIntPtr Source #
Multiplicative CUIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUIntPtr Source # (*) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUIntPtr -> n -> CUIntPtr Source #
Multiplicative CIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CIntMax Source # (*) :: CIntMax -> CIntMax -> CIntMax Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CIntMax -> n -> CIntMax Source #
Multiplicative CUIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUIntMax Source # (*) :: CUIntMax -> CUIntMax -> CUIntMax Source # (^) :: (IsNatural n, Enum n, IDivisible n) => CUIntMax -> n -> CUIntMax Source #
Multiplicative Word256 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word256 Source # (*) :: Word256 -> Word256 -> Word256 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word256 -> n -> Word256 Source #
Multiplicative Word128 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word128 Source # (*) :: Word128 -> Word128 -> Word128 Source # (^) :: (IsNatural n, Enum n, IDivisible n) => Word128 -> n -> Word128 Source #
SizeValid n => Multiplicative (Bits n) |
Instance details Defined in Basement.Bits Methods midentity :: Bits n Source # (*) :: Bits n -> Bits n -> Bits n Source # (^) :: (IsNatural n0, Enum n0, IDivisible n0) => Bits n -> n0 -> Bits n Source #

class (Additive a, Multiplicative a) => IDivisible a where Source #

Represent types that supports an euclidian division

    (x ‘div‘ y) * y + (x ‘mod‘ y) == x

Minimal complete definition

div, mod | divMod

Methods

div :: a -> a -> a Source #

mod :: a -> a -> a Source #

divMod :: a -> a -> (a, a) Source #

Instances

IDivisible Int |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int -> Int -> Int Source # mod :: Int -> Int -> Int Source # divMod :: Int -> Int -> (Int, Int) Source #
IDivisible Int8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int8 -> Int8 -> Int8 Source # mod :: Int8 -> Int8 -> Int8 Source # divMod :: Int8 -> Int8 -> (Int8, Int8) Source #
IDivisible Int16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int16 -> Int16 -> Int16 Source # mod :: Int16 -> Int16 -> Int16 Source # divMod :: Int16 -> Int16 -> (Int16, Int16) Source #
IDivisible Int32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int32 -> Int32 -> Int32 Source # mod :: Int32 -> Int32 -> Int32 Source # divMod :: Int32 -> Int32 -> (Int32, Int32) Source #
IDivisible Int64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int64 -> Int64 -> Int64 Source # mod :: Int64 -> Int64 -> Int64 Source # divMod :: Int64 -> Int64 -> (Int64, Int64) Source #
IDivisible Integer |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Integer -> Integer -> Integer Source # mod :: Integer -> Integer -> Integer Source # divMod :: Integer -> Integer -> (Integer, Integer) Source #
IDivisible Natural |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Natural -> Natural -> Natural Source # mod :: Natural -> Natural -> Natural Source # divMod :: Natural -> Natural -> (Natural, Natural) Source #
IDivisible Word |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word -> Word -> Word Source # mod :: Word -> Word -> Word Source # divMod :: Word -> Word -> (Word, Word) Source #
IDivisible Word8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word8 -> Word8 -> Word8 Source # mod :: Word8 -> Word8 -> Word8 Source # divMod :: Word8 -> Word8 -> (Word8, Word8) Source #
IDivisible Word16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word16 -> Word16 -> Word16 Source # mod :: Word16 -> Word16 -> Word16 Source # divMod :: Word16 -> Word16 -> (Word16, Word16) Source #
IDivisible Word32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word32 -> Word32 -> Word32 Source # mod :: Word32 -> Word32 -> Word32 Source # divMod :: Word32 -> Word32 -> (Word32, Word32) Source #
IDivisible Word64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word64 -> Word64 -> Word64 Source # mod :: Word64 -> Word64 -> Word64 Source # divMod :: Word64 -> Word64 -> (Word64, Word64) Source #
IDivisible CChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CChar -> CChar -> CChar Source # mod :: CChar -> CChar -> CChar Source # divMod :: CChar -> CChar -> (CChar, CChar) Source #
IDivisible CSChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSChar -> CSChar -> CSChar Source # mod :: CSChar -> CSChar -> CSChar Source # divMod :: CSChar -> CSChar -> (CSChar, CSChar) Source #
IDivisible CUChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUChar -> CUChar -> CUChar Source # mod :: CUChar -> CUChar -> CUChar Source # divMod :: CUChar -> CUChar -> (CUChar, CUChar) Source #
IDivisible CShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CShort -> CShort -> CShort Source # mod :: CShort -> CShort -> CShort Source # divMod :: CShort -> CShort -> (CShort, CShort) Source #
IDivisible CUShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUShort -> CUShort -> CUShort Source # mod :: CUShort -> CUShort -> CUShort Source # divMod :: CUShort -> CUShort -> (CUShort, CUShort) Source #
IDivisible CInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CInt -> CInt -> CInt Source # mod :: CInt -> CInt -> CInt Source # divMod :: CInt -> CInt -> (CInt, CInt) Source #
IDivisible CUInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUInt -> CUInt -> CUInt Source # mod :: CUInt -> CUInt -> CUInt Source # divMod :: CUInt -> CUInt -> (CUInt, CUInt) Source #
IDivisible CLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CLong -> CLong -> CLong Source # mod :: CLong -> CLong -> CLong Source # divMod :: CLong -> CLong -> (CLong, CLong) Source #
IDivisible CULong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CULong -> CULong -> CULong Source # mod :: CULong -> CULong -> CULong Source # divMod :: CULong -> CULong -> (CULong, CULong) Source #
IDivisible CLLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CLLong -> CLLong -> CLLong Source # mod :: CLLong -> CLLong -> CLLong Source # divMod :: CLLong -> CLLong -> (CLLong, CLLong) Source #
IDivisible CULLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CULLong -> CULLong -> CULLong Source # mod :: CULLong -> CULLong -> CULLong Source # divMod :: CULLong -> CULLong -> (CULLong, CULLong) Source #
IDivisible CPtrdiff |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # mod :: CPtrdiff -> CPtrdiff -> CPtrdiff Source # divMod :: CPtrdiff -> CPtrdiff -> (CPtrdiff, CPtrdiff) Source #
IDivisible CSize |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSize -> CSize -> CSize Source # mod :: CSize -> CSize -> CSize Source # divMod :: CSize -> CSize -> (CSize, CSize) Source #
IDivisible CWchar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CWchar -> CWchar -> CWchar Source # mod :: CWchar -> CWchar -> CWchar Source # divMod :: CWchar -> CWchar -> (CWchar, CWchar) Source #
IDivisible CSigAtomic |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # mod :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # divMod :: CSigAtomic -> CSigAtomic -> (CSigAtomic, CSigAtomic) Source #
IDivisible CIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CIntPtr -> CIntPtr -> CIntPtr Source # mod :: CIntPtr -> CIntPtr -> CIntPtr Source # divMod :: CIntPtr -> CIntPtr -> (CIntPtr, CIntPtr) Source #
IDivisible CUIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # mod :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # divMod :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) Source #
IDivisible CIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CIntMax -> CIntMax -> CIntMax Source # mod :: CIntMax -> CIntMax -> CIntMax Source # divMod :: CIntMax -> CIntMax -> (CIntMax, CIntMax) Source #
IDivisible CUIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUIntMax -> CUIntMax -> CUIntMax Source # mod :: CUIntMax -> CUIntMax -> CUIntMax Source # divMod :: CUIntMax -> CUIntMax -> (CUIntMax, CUIntMax) Source #
IDivisible Word256 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word256 -> Word256 -> Word256 Source # mod :: Word256 -> Word256 -> Word256 Source # divMod :: Word256 -> Word256 -> (Word256, Word256) Source #
IDivisible Word128 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word128 -> Word128 -> Word128 Source # mod :: Word128 -> Word128 -> Word128 Source # divMod :: Word128 -> Word128 -> (Word128, Word128) Source #
SizeValid n => IDivisible (Bits n) |
Instance details Defined in Basement.Bits Methods div :: Bits n -> Bits n -> Bits n Source # mod :: Bits n -> Bits n -> Bits n Source # divMod :: Bits n -> Bits n -> (Bits n, Bits n) Source #

class Multiplicative a => Divisible a where Source #

Support for division between same types

This is likely to change to represent specific mathematic divisions

Methods

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

Instances

Divisible Double |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Double -> Double -> Double Source #
Divisible Float |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Float -> Float -> Float Source #
Divisible Rational |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Rational -> Rational -> Rational Source #
Divisible CFloat |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: CFloat -> CFloat -> CFloat Source #
Divisible CDouble |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: CDouble -> CDouble -> CDouble Source #

data Sign Source #

Sign of a signed number

Constructors

SignNegative |
SignZero |
SignPositive |

Instances

Eq Sign Source # |
Instance details Defined in Foundation.Numerical Methods (==) :: Sign -> Sign -> Bool Source # (/=) :: Sign -> Sign -> Bool Source #

recip :: Divisible a => a -> a Source #

class IntegralRounding a where Source #

Methods

roundUp :: Integral n => a -> n Source #

Round up, to the next integral.

Also known as `ceiling`

roundDown :: Integral n => a -> n Source #

Round down, to the previous integral

Also known as `floor`

roundTruncate :: Integral n => a -> n Source #

Truncate to the closest integral to the fractional number closer to 0.

This is equivalent to roundUp for negative Number and roundDown for positive Number

roundNearest :: Integral n => a -> n Source #

Round to the nearest integral

    roundNearest 3.6

4 > roundNearest 3.4 3

Instances

IntegralRounding Double Source # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Double -> n Source # roundDown :: Integral n => Double -> n Source # roundTruncate :: Integral n => Double -> n Source # roundNearest :: Integral n => Double -> n Source #
IntegralRounding Float Source # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Float -> n Source # roundDown :: Integral n => Float -> n Source # roundTruncate :: Integral n => Float -> n Source # roundNearest :: Integral n => Float -> n Source #
IntegralRounding Rational Source # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Rational -> n Source # roundDown :: Integral n => Rational -> n Source # roundTruncate :: Integral n => Rational -> n Source # roundNearest :: Integral n => Rational -> n Source #

class FloatingPoint a where Source #

IEEE754 Floating Point

Methods

floatRadix :: Proxy a -> Integer Source #

floatDigits :: Proxy a -> Int Source #

floatRange :: Proxy a -> (Int, Int) Source #

floatDecode :: a -> (Integer, Int) Source #

floatEncode :: Integer -> Int -> a Source #

Instances

FloatingPoint Double Source # |
Instance details Defined in Foundation.Numerical.Floating Methods floatRadix :: Proxy Double -> Integer Source # floatDigits :: Proxy Double -> Int Source # floatRange :: Proxy Double -> (Int, Int) Source # floatDecode :: Double -> (Integer, Int) Source # floatEncode :: Integer -> Int -> Double Source #
FloatingPoint Float Source # |
Instance details Defined in Foundation.Numerical.Floating Methods floatRadix :: Proxy Float -> Integer Source # floatDigits :: Proxy Float -> Int Source # floatRange :: Proxy Float -> (Int, Int) Source # floatDecode :: Float -> (Integer, Int) Source # floatEncode :: Integer -> Int -> Float Source #