Basement.Numerical.Multiplicative

basement-0.0.16: Foundation scrap box of array & string

Safe Haskell | None
Language | Haskell2010

Basement.Numerical.Multiplicative

Synopsis

- 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
- recip :: Divisible a => a -> a

# Documentation

class Multiplicative a where #

Represent class of things that can be multiplied together

    x * midentity = x
    midentity * x = x

Minimal complete definition

midentity, (*)

Methods

midentity :: a #

Identity element over multiplication

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

Multiplication of 2 elements that result in another element

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

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

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

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 #

mod :: a -> a -> a #

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

#### Instances

Instances details

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

class Multiplicative a => Divisible a where #

Support for division between same types

This is likely to change to represent specific mathematic divisions

Methods

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

#### Instances

Instances details

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

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