basement-0.0.4: Foundation scrap box of array & string

Safe Haskell | None
Language | Haskell2010

Basement.Numerical.Multiplicative

Synopsis

- class Multiplicative a where
- class (Additive a, Multiplicative a) => IDivisible a where
- class Multiplicative a => Divisible a where
- recip :: Divisible a => a -> a

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

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 # |
Methods div :: Int16 -> Int16 -> Int16 Source # mod :: Int16 -> Int16 -> Int16 Source # divMod :: Int16 -> Int16 -> (Int16, Int16) Source #
IDivisible Int32 Source # |
Methods div :: Int32 -> Int32 -> Int32 Source # mod :: Int32 -> Int32 -> Int32 Source # divMod :: Int32 -> Int32 -> (Int32, Int32) Source #
IDivisible Int64 Source # |
Methods div :: Int64 -> Int64 -> Int64 Source # mod :: Int64 -> Int64 -> Int64 Source # divMod :: Int64 -> Int64 -> (Int64, Int64) Source #
IDivisible Integer Source # |
Methods div :: Integer -> Integer -> Integer Source # mod :: Integer -> Integer -> Integer Source # divMod :: Integer -> Integer -> (Integer, Integer) Source #
IDivisible Word Source # |
Methods div :: Word -> Word -> Word Source # mod :: Word -> Word -> Word Source # divMod :: Word -> Word -> (Word, Word) Source #
IDivisible Word8 Source # |
Methods div :: Word8 -> Word8 -> Word8 Source # mod :: Word8 -> Word8 -> Word8 Source # divMod :: Word8 -> Word8 -> (Word8, Word8) Source #
IDivisible Word16 Source # |
Methods div :: Word16 -> Word16 -> Word16 Source # mod :: Word16 -> Word16 -> Word16 Source # divMod :: Word16 -> Word16 -> (Word16, Word16) Source #
IDivisible Word32 Source # |
Methods div :: Word32 -> Word32 -> Word32 Source # mod :: Word32 -> Word32 -> Word32 Source # divMod :: Word32 -> Word32 -> (Word32, Word32) Source #
IDivisible Word64 Source # |
Methods div :: Word64 -> Word64 -> Word64 Source # mod :: Word64 -> Word64 -> Word64 Source # divMod :: Word64 -> Word64 -> (Word64, Word64) Source #
IDivisible Natural Source # |
Methods div :: Natural -> Natural -> Natural Source # mod :: Natural -> Natural -> Natural Source # divMod :: Natural -> Natural -> (Natural, Natural) Source #
IDivisible Word128 Source # |
Methods div :: Word128 -> Word128 -> Word128 Source # mod :: Word128 -> Word128 -> Word128 Source # divMod :: Word128 -> Word128 -> (Word128, Word128) Source #
IDivisible Word256 Source # |
Methods div :: Word256 -> Word256 -> Word256 Source # mod :: Word256 -> Word256 -> Word256 Source # divMod :: Word256 -> Word256 -> (Word256, 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 #

Instances

Divisible Double Source # |
Methods (/) :: Double -> Double -> Double Source #
Divisible Float Source # |
Methods (/) :: Float -> Float -> Float Source #
Divisible Rational Source # |
Methods (/) :: Rational -> Rational -> Rational Source #

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