basement-0.0.6: Foundation scrap box of array & string

Safe HaskellNone
LanguageHaskell2010

Basement.Numerical.Multiplicative

Synopsis

Documentation

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, 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 Source # 
Multiplicative Float Source # 
Multiplicative Int Source # 

Methods

midentity :: Int Source #

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

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

Multiplicative Int8 Source # 

Methods

midentity :: Int8 Source #

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

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

Multiplicative Int16 Source # 
Multiplicative Int32 Source # 
Multiplicative Int64 Source # 
Multiplicative Integer Source # 
Multiplicative Natural Source # 
Multiplicative Rational Source # 
Multiplicative Word Source # 

Methods

midentity :: Word Source #

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

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

Multiplicative Word8 Source # 
Multiplicative Word16 Source # 
Multiplicative Word32 Source # 
Multiplicative Word64 Source # 
Multiplicative COff Source # 

Methods

midentity :: COff Source #

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

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

Multiplicative CChar Source # 
Multiplicative CSChar Source # 
Multiplicative CUChar Source # 
Multiplicative CShort Source # 
Multiplicative CUShort Source # 
Multiplicative CInt Source # 

Methods

midentity :: CInt Source #

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

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

Multiplicative CUInt Source # 
Multiplicative CLong Source # 
Multiplicative CULong Source # 
Multiplicative CLLong Source # 
Multiplicative CULLong Source # 
Multiplicative CFloat Source # 
Multiplicative CDouble Source # 
Multiplicative CPtrdiff Source # 
Multiplicative CSize Source # 
Multiplicative CWchar Source # 
Multiplicative CSigAtomic Source # 
Multiplicative CClock Source # 
Multiplicative CTime Source # 
Multiplicative CUSeconds Source # 
Multiplicative CSUSeconds Source # 
Multiplicative CIntPtr Source # 
Multiplicative CUIntPtr Source # 
Multiplicative CIntMax Source # 
Multiplicative CUIntMax Source # 
Multiplicative Word128 Source # 
Multiplicative Word256 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 Source # 

Methods

div :: Int -> Int -> Int Source #

mod :: Int -> Int -> Int Source #

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

IDivisible Int8 Source # 

Methods

div :: Int8 -> Int8 -> Int8 Source #

mod :: Int8 -> Int8 -> Int8 Source #

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

IDivisible Int16 Source # 
IDivisible Int32 Source # 
IDivisible Int64 Source # 
IDivisible Integer Source # 
IDivisible Natural Source # 
IDivisible Word Source # 

Methods

div :: Word -> Word -> Word Source #

mod :: Word -> Word -> Word Source #

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

IDivisible Word8 Source # 
IDivisible Word16 Source # 
IDivisible Word32 Source # 
IDivisible Word64 Source # 
IDivisible CChar Source # 
IDivisible CSChar Source # 
IDivisible CUChar Source # 
IDivisible CShort Source # 
IDivisible CUShort Source # 
IDivisible CInt Source # 

Methods

div :: CInt -> CInt -> CInt Source #

mod :: CInt -> CInt -> CInt Source #

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

IDivisible CUInt Source # 
IDivisible CLong Source # 
IDivisible CULong Source # 
IDivisible CLLong Source # 
IDivisible CULLong Source # 
IDivisible CPtrdiff Source # 
IDivisible CSize Source # 
IDivisible CWchar Source # 
IDivisible CSigAtomic Source # 
IDivisible CIntPtr Source # 
IDivisible CUIntPtr Source # 
IDivisible CIntMax Source # 
IDivisible CUIntMax Source # 
IDivisible Word128 Source # 
IDivisible Word256 Source # 

class Multiplicative a => Divisible a where Source #

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

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