basement-0.0.7: Foundation scrap box of array & string

Safe HaskellNone
LanguageHaskell2010

Basement.Numerical.Multiplicative

Synopsis

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

Multiplicative Double # 

Methods

midentity :: Double #

(*) :: Double -> Double -> Double #

(^) :: (IsNatural n, IDivisible n) => Double -> n -> Double #

Multiplicative Float # 

Methods

midentity :: Float #

(*) :: Float -> Float -> Float #

(^) :: (IsNatural n, IDivisible n) => Float -> n -> Float #

Multiplicative Int # 

Methods

midentity :: Int #

(*) :: Int -> Int -> Int #

(^) :: (IsNatural n, IDivisible n) => Int -> n -> Int #

Multiplicative Int8 # 

Methods

midentity :: Int8 #

(*) :: Int8 -> Int8 -> Int8 #

(^) :: (IsNatural n, IDivisible n) => Int8 -> n -> Int8 #

Multiplicative Int16 # 

Methods

midentity :: Int16 #

(*) :: Int16 -> Int16 -> Int16 #

(^) :: (IsNatural n, IDivisible n) => Int16 -> n -> Int16 #

Multiplicative Int32 # 

Methods

midentity :: Int32 #

(*) :: Int32 -> Int32 -> Int32 #

(^) :: (IsNatural n, IDivisible n) => Int32 -> n -> Int32 #

Multiplicative Int64 # 

Methods

midentity :: Int64 #

(*) :: Int64 -> Int64 -> Int64 #

(^) :: (IsNatural n, IDivisible n) => Int64 -> n -> Int64 #

Multiplicative Integer # 
Multiplicative Natural # 
Multiplicative Rational # 
Multiplicative Word # 

Methods

midentity :: Word #

(*) :: Word -> Word -> Word #

(^) :: (IsNatural n, IDivisible n) => Word -> n -> Word #

Multiplicative Word8 # 

Methods

midentity :: Word8 #

(*) :: Word8 -> Word8 -> Word8 #

(^) :: (IsNatural n, IDivisible n) => Word8 -> n -> Word8 #

Multiplicative Word16 # 

Methods

midentity :: Word16 #

(*) :: Word16 -> Word16 -> Word16 #

(^) :: (IsNatural n, IDivisible n) => Word16 -> n -> Word16 #

Multiplicative Word32 # 

Methods

midentity :: Word32 #

(*) :: Word32 -> Word32 -> Word32 #

(^) :: (IsNatural n, IDivisible n) => Word32 -> n -> Word32 #

Multiplicative Word64 # 

Methods

midentity :: Word64 #

(*) :: Word64 -> Word64 -> Word64 #

(^) :: (IsNatural n, IDivisible n) => Word64 -> n -> Word64 #

Multiplicative COff # 

Methods

midentity :: COff #

(*) :: COff -> COff -> COff #

(^) :: (IsNatural n, IDivisible n) => COff -> n -> COff #

Multiplicative CChar # 

Methods

midentity :: CChar #

(*) :: CChar -> CChar -> CChar #

(^) :: (IsNatural n, IDivisible n) => CChar -> n -> CChar #

Multiplicative CSChar # 

Methods

midentity :: CSChar #

(*) :: CSChar -> CSChar -> CSChar #

(^) :: (IsNatural n, IDivisible n) => CSChar -> n -> CSChar #

Multiplicative CUChar # 

Methods

midentity :: CUChar #

(*) :: CUChar -> CUChar -> CUChar #

(^) :: (IsNatural n, IDivisible n) => CUChar -> n -> CUChar #

Multiplicative CShort # 

Methods

midentity :: CShort #

(*) :: CShort -> CShort -> CShort #

(^) :: (IsNatural n, IDivisible n) => CShort -> n -> CShort #

Multiplicative CUShort # 
Multiplicative CInt # 

Methods

midentity :: CInt #

(*) :: CInt -> CInt -> CInt #

(^) :: (IsNatural n, IDivisible n) => CInt -> n -> CInt #

Multiplicative CUInt # 

Methods

midentity :: CUInt #

(*) :: CUInt -> CUInt -> CUInt #

(^) :: (IsNatural n, IDivisible n) => CUInt -> n -> CUInt #

Multiplicative CLong # 

Methods

midentity :: CLong #

(*) :: CLong -> CLong -> CLong #

(^) :: (IsNatural n, IDivisible n) => CLong -> n -> CLong #

Multiplicative CULong # 

Methods

midentity :: CULong #

(*) :: CULong -> CULong -> CULong #

(^) :: (IsNatural n, IDivisible n) => CULong -> n -> CULong #

Multiplicative CLLong # 

Methods

midentity :: CLLong #

(*) :: CLLong -> CLLong -> CLLong #

(^) :: (IsNatural n, IDivisible n) => CLLong -> n -> CLLong #

Multiplicative CULLong # 
Multiplicative CFloat # 

Methods

midentity :: CFloat #

(*) :: CFloat -> CFloat -> CFloat #

(^) :: (IsNatural n, IDivisible n) => CFloat -> n -> CFloat #

Multiplicative CDouble # 
Multiplicative CPtrdiff # 
Multiplicative CSize # 

Methods

midentity :: CSize #

(*) :: CSize -> CSize -> CSize #

(^) :: (IsNatural n, IDivisible n) => CSize -> n -> CSize #

Multiplicative CWchar # 

Methods

midentity :: CWchar #

(*) :: CWchar -> CWchar -> CWchar #

(^) :: (IsNatural n, IDivisible n) => CWchar -> n -> CWchar #

Multiplicative CSigAtomic # 
Multiplicative CClock # 

Methods

midentity :: CClock #

(*) :: CClock -> CClock -> CClock #

(^) :: (IsNatural n, IDivisible n) => CClock -> n -> CClock #

Multiplicative CTime # 

Methods

midentity :: CTime #

(*) :: CTime -> CTime -> CTime #

(^) :: (IsNatural n, IDivisible n) => CTime -> n -> CTime #

Multiplicative CUSeconds # 
Multiplicative CSUSeconds # 
Multiplicative CIntPtr # 
Multiplicative CUIntPtr # 
Multiplicative CIntMax # 
Multiplicative CUIntMax # 
Multiplicative Word128 # 
Multiplicative Word256 # 
SizeValid n => Multiplicative (Bits n) # 

Methods

midentity :: Bits n #

(*) :: Bits n -> Bits n -> Bits n #

(^) :: (IsNatural n, IDivisible n) => Bits n -> n -> 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

IDivisible Int # 

Methods

div :: Int -> Int -> Int #

mod :: Int -> Int -> Int #

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

IDivisible Int8 # 

Methods

div :: Int8 -> Int8 -> Int8 #

mod :: Int8 -> Int8 -> Int8 #

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

IDivisible Int16 # 

Methods

div :: Int16 -> Int16 -> Int16 #

mod :: Int16 -> Int16 -> Int16 #

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

IDivisible Int32 # 

Methods

div :: Int32 -> Int32 -> Int32 #

mod :: Int32 -> Int32 -> Int32 #

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

IDivisible Int64 # 

Methods

div :: Int64 -> Int64 -> Int64 #

mod :: Int64 -> Int64 -> Int64 #

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

IDivisible Integer # 
IDivisible Natural # 
IDivisible Word # 

Methods

div :: Word -> Word -> Word #

mod :: Word -> Word -> Word #

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

IDivisible Word8 # 

Methods

div :: Word8 -> Word8 -> Word8 #

mod :: Word8 -> Word8 -> Word8 #

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

IDivisible Word16 # 

Methods

div :: Word16 -> Word16 -> Word16 #

mod :: Word16 -> Word16 -> Word16 #

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

IDivisible Word32 # 

Methods

div :: Word32 -> Word32 -> Word32 #

mod :: Word32 -> Word32 -> Word32 #

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

IDivisible Word64 # 

Methods

div :: Word64 -> Word64 -> Word64 #

mod :: Word64 -> Word64 -> Word64 #

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

IDivisible CChar # 

Methods

div :: CChar -> CChar -> CChar #

mod :: CChar -> CChar -> CChar #

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

IDivisible CSChar # 

Methods

div :: CSChar -> CSChar -> CSChar #

mod :: CSChar -> CSChar -> CSChar #

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

IDivisible CUChar # 

Methods

div :: CUChar -> CUChar -> CUChar #

mod :: CUChar -> CUChar -> CUChar #

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

IDivisible CShort # 

Methods

div :: CShort -> CShort -> CShort #

mod :: CShort -> CShort -> CShort #

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

IDivisible CUShort # 
IDivisible CInt # 

Methods

div :: CInt -> CInt -> CInt #

mod :: CInt -> CInt -> CInt #

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

IDivisible CUInt # 

Methods

div :: CUInt -> CUInt -> CUInt #

mod :: CUInt -> CUInt -> CUInt #

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

IDivisible CLong # 

Methods

div :: CLong -> CLong -> CLong #

mod :: CLong -> CLong -> CLong #

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

IDivisible CULong # 

Methods

div :: CULong -> CULong -> CULong #

mod :: CULong -> CULong -> CULong #

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

IDivisible CLLong # 

Methods

div :: CLLong -> CLLong -> CLLong #

mod :: CLLong -> CLLong -> CLLong #

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

IDivisible CULLong # 
IDivisible CPtrdiff # 
IDivisible CSize # 

Methods

div :: CSize -> CSize -> CSize #

mod :: CSize -> CSize -> CSize #

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

IDivisible CWchar # 

Methods

div :: CWchar -> CWchar -> CWchar #

mod :: CWchar -> CWchar -> CWchar #

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

IDivisible CSigAtomic # 
IDivisible CIntPtr # 
IDivisible CUIntPtr # 
IDivisible CIntMax # 
IDivisible CUIntMax # 
IDivisible Word128 # 
IDivisible Word256 # 
SizeValid n => IDivisible (Bits n) # 

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

Minimal complete definition

(/)

Methods

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

Instances

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