foundation-0.0.30: Alternative prelude with batteries and no dependencies
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

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

Instances details
IsIntegral CBool 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CChar 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CInt 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CIntMax 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CIntPtr 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CLLong 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CLong 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CPtrdiff 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CSChar 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CShort 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CSigAtomic 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CSize 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CUChar 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CUInt 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CUIntMax 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CUIntPtr 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CULLong 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CULong 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CUShort 
Instance details

Defined in Basement.Numerical.Number

IsIntegral CWchar 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Int16 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Int32 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Int64 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Int8 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word16 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word32 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word64 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word8 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word128 
Instance details

Defined in Basement.Types.Word128

IsIntegral Word256 
Instance details

Defined in Basement.Types.Word256

IsIntegral Integer 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Natural 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Int 
Instance details

Defined in Basement.Numerical.Number

IsIntegral Word 
Instance details

Defined in Basement.Numerical.Number

KnownNat n => IsIntegral (Zn n) 
Instance details

Defined in Basement.Bounded

Methods

toInteger :: Zn n -> Integer Source #

(KnownNat n, NatWithinBound Word64 n) => IsIntegral (Zn64 n) 
Instance details

Defined in Basement.Bounded

Methods

toInteger :: Zn64 n -> Integer Source #

IsIntegral (CountOf ty) 
Instance details

Defined in Basement.Types.OffsetSize

Methods

toInteger :: CountOf ty -> Integer Source #

IsIntegral (Offset ty) 
Instance details

Defined in Basement.Types.OffsetSize

Methods

toInteger :: Offset ty -> 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

Instances details
IsNatural CSize 
Instance details

Defined in Basement.Numerical.Number

IsNatural CUChar 
Instance details

Defined in Basement.Numerical.Number

IsNatural CUInt 
Instance details

Defined in Basement.Numerical.Number

IsNatural CUIntMax 
Instance details

Defined in Basement.Numerical.Number

IsNatural CUIntPtr 
Instance details

Defined in Basement.Numerical.Number

IsNatural CULLong 
Instance details

Defined in Basement.Numerical.Number

IsNatural CULong 
Instance details

Defined in Basement.Numerical.Number

IsNatural CUShort 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word16 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word32 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word64 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word8 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word128 
Instance details

Defined in Basement.Types.Word128

IsNatural Word256 
Instance details

Defined in Basement.Types.Word256

IsNatural Natural 
Instance details

Defined in Basement.Numerical.Number

IsNatural Word 
Instance details

Defined in Basement.Numerical.Number

KnownNat n => IsNatural (Zn n) 
Instance details

Defined in Basement.Bounded

Methods

toNatural :: Zn n -> Natural Source #

(KnownNat n, NatWithinBound Word64 n) => IsNatural (Zn64 n) 
Instance details

Defined in Basement.Bounded

Methods

toNatural :: Zn64 n -> Natural Source #

IsNatural (CountOf ty) 
Instance details

Defined in Basement.Types.OffsetSize

Methods

toNatural :: CountOf ty -> Natural Source #

IsNatural (Offset ty) 
Instance details

Defined in Basement.Types.OffsetSize

Methods

toNatural :: Offset ty -> 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

Instances details
Signed Int16 Source # 
Instance details

Defined in Foundation.Numerical

Signed Int32 Source # 
Instance details

Defined in Foundation.Numerical

Signed Int64 Source # 
Instance details

Defined in Foundation.Numerical

Signed Int8 Source # 
Instance details

Defined in Foundation.Numerical

Methods

abs :: Int8 -> Int8 Source #

signum :: Int8 -> Sign Source #

Signed Integer Source # 
Instance details

Defined in Foundation.Numerical

Signed Double Source # 
Instance details

Defined in Foundation.Numerical

Signed Float Source # 
Instance details

Defined in Foundation.Numerical

Signed Int Source # 
Instance details

Defined in Foundation.Numerical

Methods

abs :: Int -> Int Source #

signum :: Int -> 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

Instances details
Additive CChar 
Instance details

Defined in Basement.Numerical.Additive

Additive CClock 
Instance details

Defined in Basement.Numerical.Additive

Additive CDouble 
Instance details

Defined in Basement.Numerical.Additive

Additive CFloat 
Instance details

Defined in Basement.Numerical.Additive

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 CIntMax 
Instance details

Defined in Basement.Numerical.Additive

Additive CIntPtr 
Instance details

Defined in Basement.Numerical.Additive

Additive CLLong 
Instance details

Defined in Basement.Numerical.Additive

Additive CLong 
Instance details

Defined in Basement.Numerical.Additive

Additive CPtrdiff 
Instance details

Defined in Basement.Numerical.Additive

Additive CSChar 
Instance details

Defined in Basement.Numerical.Additive

Additive CSUSeconds 
Instance details

Defined in Basement.Numerical.Additive

Additive CShort 
Instance details

Defined in Basement.Numerical.Additive

Additive CSigAtomic 
Instance details

Defined in Basement.Numerical.Additive

Additive CSize 
Instance details

Defined in Basement.Numerical.Additive

Additive CTime 
Instance details

Defined in Basement.Numerical.Additive

Additive CUChar 
Instance details

Defined in Basement.Numerical.Additive

Additive CUInt 
Instance details

Defined in Basement.Numerical.Additive

Additive CUIntMax 
Instance details

Defined in Basement.Numerical.Additive

Additive CUIntPtr 
Instance details

Defined in Basement.Numerical.Additive

Additive CULLong 
Instance details

Defined in Basement.Numerical.Additive

Additive CULong 
Instance details

Defined in Basement.Numerical.Additive

Additive CUSeconds 
Instance details

Defined in Basement.Numerical.Additive

Additive CUShort 
Instance details

Defined in Basement.Numerical.Additive

Additive CWchar 
Instance details

Defined in Basement.Numerical.Additive

Additive Int16 
Instance details

Defined in Basement.Numerical.Additive

Additive Int32 
Instance details

Defined in Basement.Numerical.Additive

Additive Int64 
Instance details

Defined in Basement.Numerical.Additive

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 Rational 
Instance details

Defined in Basement.Numerical.Additive

Additive Word16 
Instance details

Defined in Basement.Numerical.Additive

Additive Word32 
Instance details

Defined in Basement.Numerical.Additive

Additive Word64 
Instance details

Defined in Basement.Numerical.Additive

Additive Word8 
Instance details

Defined in Basement.Numerical.Additive

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 Word128 
Instance details

Defined in Basement.Numerical.Additive

Additive Word256 
Instance details

Defined in Basement.Numerical.Additive

Additive NanoSeconds Source # 
Instance details

Defined in Foundation.Time.Types

Additive Seconds Source # 
Instance details

Defined in Foundation.Time.Types

Additive Integer 
Instance details

Defined in Basement.Numerical.Additive

Additive Natural 
Instance details

Defined in Basement.Numerical.Additive

Additive Double 
Instance details

Defined in Basement.Numerical.Additive

Additive Float 
Instance details

Defined in Basement.Numerical.Additive

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 Word 
Instance details

Defined in Basement.Numerical.Additive

Methods

azero :: Word Source #

(+) :: Word -> Word -> Word Source #

scale :: IsNatural n => n -> Word -> Word 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 #

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 #

(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 #

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 #

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 #

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

Methods

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

Instances

Instances details
Subtractive CBool 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CBool Source #

Subtractive CChar 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CChar Source #

Subtractive CClock 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CClock Source #

Subtractive CDouble 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CDouble Source #

Subtractive CFloat 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CFloat Source #

Subtractive CInt 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CInt Source #

Methods

(-) :: CInt -> CInt -> Difference CInt Source #

Subtractive CIntMax 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CIntMax Source #

Subtractive CIntPtr 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CIntPtr Source #

Subtractive CLLong 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CLLong Source #

Subtractive CLong 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CLong Source #

Subtractive CPtrdiff 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CPtrdiff Source #

Subtractive CSChar 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CSChar Source #

Subtractive CSUSeconds 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CSUSeconds Source #

Subtractive CShort 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CShort Source #

Subtractive CSigAtomic 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CSigAtomic Source #

Subtractive CSize 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CSize Source #

Subtractive CTime 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CTime Source #

Subtractive CUChar 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUChar Source #

Subtractive CUInt 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUInt Source #

Subtractive CUIntMax 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUIntMax Source #

Subtractive CUIntPtr 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUIntPtr Source #

Subtractive CULLong 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CULLong Source #

Subtractive CULong 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CULong Source #

Subtractive CUSeconds 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUSeconds Source #

Subtractive CUShort 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CUShort Source #

Subtractive CWchar 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference CWchar Source #

Subtractive Int16 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Int16 Source #

Subtractive Int32 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Int32 Source #

Subtractive Int64 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Int64 Source #

Subtractive Int8 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Int8 Source #

Methods

(-) :: Int8 -> Int8 -> Difference Int8 Source #

Subtractive Word16 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word16 Source #

Subtractive Word32 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word32 Source #

Subtractive Word64 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word64 Source #

Subtractive Word8 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word8 Source #

Subtractive COff 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference COff Source #

Methods

(-) :: COff -> COff -> Difference COff Source #

Subtractive Word128 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word128 Source #

Subtractive Word256 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word256 Source #

Subtractive Integer 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Integer Source #

Subtractive Natural 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Natural Source #

Subtractive Char 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Char Source #

Methods

(-) :: Char -> Char -> Difference Char Source #

Subtractive Double 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Double Source #

Subtractive Float 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Float Source #

Subtractive Int 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Int Source #

Methods

(-) :: Int -> Int -> Difference Int Source #

Subtractive Word 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference Word Source #

Methods

(-) :: Word -> Word -> Difference Word Source #

SizeValid n => Subtractive (Bits n) 
Instance details

Defined in Basement.Bits

Associated Types

type Difference (Bits n) Source #

Methods

(-) :: Bits n -> Bits n -> Difference (Bits n) Source #

KnownNat n => Subtractive (Zn n) 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference (Zn n) Source #

Methods

(-) :: Zn n -> Zn n -> Difference (Zn n) Source #

(KnownNat n, NatWithinBound Word64 n) => Subtractive (Zn64 n) 
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference (Zn64 n) Source #

Methods

(-) :: Zn64 n -> Zn64 n -> Difference (Zn64 n) Source #

Subtractive (CountOf ty) 
Instance details

Defined in Basement.Types.OffsetSize

Associated Types

type Difference (CountOf ty) Source #

Methods

(-) :: CountOf ty -> CountOf ty -> Difference (CountOf ty) Source #

Subtractive (Offset ty) 
Instance details

Defined in Basement.Types.OffsetSize

Associated Types

type Difference (Offset ty) Source #

Methods

(-) :: Offset ty -> Offset ty -> Difference (Offset ty) 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

Instances details
Multiplicative CChar 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CClock 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CDouble 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CFloat 
Instance details

Defined in Basement.Numerical.Multiplicative

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 CIntMax 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CIntPtr 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CLLong 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CLong 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CPtrdiff 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CSChar 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CSUSeconds 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CShort 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CSigAtomic 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CSize 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CTime 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUChar 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUInt 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUIntMax 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUIntPtr 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CULLong 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CULong 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUSeconds 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CUShort 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative CWchar 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Int16 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Int32 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Int64 
Instance details

Defined in Basement.Numerical.Multiplicative

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 Rational 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Word16 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Word32 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Word64 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Word8 
Instance details

Defined in Basement.Numerical.Multiplicative

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 Word128 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Word256 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Integer 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Natural 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Double 
Instance details

Defined in Basement.Numerical.Multiplicative

Multiplicative Float 
Instance details

Defined in Basement.Numerical.Multiplicative

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

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

Instances details
IDivisible CChar 
Instance details

Defined in Basement.Numerical.Multiplicative

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 CIntMax 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CIntPtr 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CLLong 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CLong 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CPtrdiff 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CSChar 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CShort 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CSigAtomic 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CSize 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CUChar 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CUInt 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CUIntMax 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CUIntPtr 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CULLong 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CULong 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CUShort 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible CWchar 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Int16 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Int32 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Int64 
Instance details

Defined in Basement.Numerical.Multiplicative

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 Word16 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Word32 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Word64 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Word8 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Word128 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Word256 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Integer 
Instance details

Defined in Basement.Numerical.Multiplicative

IDivisible Natural 
Instance details

Defined in Basement.Numerical.Multiplicative

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

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

Instances details
Divisible CDouble 
Instance details

Defined in Basement.Numerical.Multiplicative

Methods

(/) :: CDouble -> CDouble -> CDouble Source #

Divisible CFloat 
Instance details

Defined in Basement.Numerical.Multiplicative

Methods

(/) :: CFloat -> CFloat -> CFloat Source #

Divisible Rational 
Instance details

Defined in Basement.Numerical.Multiplicative

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 #

data Sign Source #

Sign of a signed number

Instances

Instances details
Eq Sign Source # 
Instance details

Defined in Foundation.Numerical

Methods

(==) :: Sign -> Sign -> Bool #

(/=) :: Sign -> Sign -> Bool #

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

Instances details
IntegralRounding Rational Source # 
Instance details

Defined in Foundation.Numerical

IntegralRounding Double Source # 
Instance details

Defined in Foundation.Numerical

IntegralRounding Float Source # 
Instance details

Defined in Foundation.Numerical