basement-0.0.3: Foundation scrap box of array & string

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

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

 Source # Methods(^) :: (IsNatural n, IDivisible n) => Double -> n -> Double Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Float -> n -> Float Source # Source # Methods(*) :: Int -> Int -> Int Source #(^) :: (IsNatural n, IDivisible n) => Int -> n -> Int Source # Source # Methods(*) :: Int8 -> Int8 -> Int8 Source #(^) :: (IsNatural n, IDivisible n) => Int8 -> n -> Int8 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Int16 -> n -> Int16 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Int32 -> n -> Int32 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Int64 -> n -> Int64 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Integer -> n -> Integer Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Rational -> n -> Rational Source # Source # Methods(*) :: Word -> Word -> Word Source #(^) :: (IsNatural n, IDivisible n) => Word -> n -> Word Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word8 -> n -> Word8 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word16 -> n -> Word16 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word32 -> n -> Word32 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word64 -> n -> Word64 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Natural -> n -> Natural Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word128 -> n -> Word128 Source # Source # Methods(^) :: (IsNatural n, IDivisible n) => Word256 -> n -> 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

Methods

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

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

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

Instances

 Source # Methodsdiv :: Int -> Int -> Int Source #mod :: Int -> Int -> Int Source #divMod :: Int -> Int -> (Int, Int) Source # Source # Methodsdiv :: Int8 -> Int8 -> Int8 Source #mod :: Int8 -> Int8 -> Int8 Source #divMod :: Int8 -> Int8 -> (Int8, Int8) Source # Source # MethodsdivMod :: Int16 -> Int16 -> (Int16, Int16) Source # Source # MethodsdivMod :: Int32 -> Int32 -> (Int32, Int32) Source # Source # MethodsdivMod :: Int64 -> Int64 -> (Int64, Int64) Source # Source # Methods Source # Methodsdiv :: Word -> Word -> Word Source #mod :: Word -> Word -> Word Source #divMod :: Word -> Word -> (Word, Word) Source # Source # MethodsdivMod :: Word8 -> Word8 -> (Word8, Word8) Source # Source # MethodsdivMod :: Word16 -> Word16 -> (Word16, Word16) Source # Source # MethodsdivMod :: Word32 -> Word32 -> (Word32, Word32) Source # Source # MethodsdivMod :: Word64 -> Word64 -> (Word64, Word64) Source # Source # Methods Source # Methods Source # Methods

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 #

Instances

 Source # Methods Source # Methods Source # Methods

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