numhask-0.2.2.0: numeric classes

Safe HaskellNone
LanguageHaskell2010

NumHask.Algebra.Multiplicative

Description

A magma heirarchy for multiplication. The basic magma structure is repeated and prefixed with 'Multiplicative-'.

Synopsis

Documentation

class MultiplicativeMagma a where Source #

times is used as the operator for the multiplicative magam to distinguish from * which, by convention, implies commutativity

∀ a,b ∈ A: a `times` b ∈ A

law is true by construction in Haskell

Minimal complete definition

times

Methods

times :: a -> a -> a Source #

Instances

MultiplicativeMagma Bool Source # 

Methods

times :: Bool -> Bool -> Bool Source #

MultiplicativeMagma Double Source # 

Methods

times :: Double -> Double -> Double Source #

MultiplicativeMagma Float Source # 

Methods

times :: Float -> Float -> Float Source #

MultiplicativeMagma Int Source # 

Methods

times :: Int -> Int -> Int Source #

MultiplicativeMagma Int8 Source # 

Methods

times :: Int8 -> Int8 -> Int8 Source #

MultiplicativeMagma Int16 Source # 

Methods

times :: Int16 -> Int16 -> Int16 Source #

MultiplicativeMagma Int32 Source # 

Methods

times :: Int32 -> Int32 -> Int32 Source #

MultiplicativeMagma Int64 Source # 

Methods

times :: Int64 -> Int64 -> Int64 Source #

MultiplicativeMagma Integer Source # 
MultiplicativeMagma Natural Source # 
MultiplicativeMagma Word Source # 

Methods

times :: Word -> Word -> Word Source #

MultiplicativeMagma Word8 Source # 

Methods

times :: Word8 -> Word8 -> Word8 Source #

MultiplicativeMagma Word16 Source # 

Methods

times :: Word16 -> Word16 -> Word16 Source #

MultiplicativeMagma Word32 Source # 

Methods

times :: Word32 -> Word32 -> Word32 Source #

MultiplicativeMagma Word64 Source # 

Methods

times :: Word64 -> Word64 -> Word64 Source #

(MultiplicativeMagma a, AdditiveGroup a) => MultiplicativeMagma (Complex a) Source # 

Methods

times :: Complex a -> Complex a -> Complex a Source #

(Ord a, Signed a, Integral a, AdditiveInvertible a) => MultiplicativeMagma (Ratio a) Source # 

Methods

times :: Ratio a -> Ratio a -> Ratio a Source #

class MultiplicativeMagma a => MultiplicativeInvertible a where Source #

Invertible magma for multiplication.

∀ a ∈ A: recip a ∈ A

law is true by construction in Haskell

Minimal complete definition

recip

Methods

recip :: a -> a Source #

product :: (Multiplicative a, Foldable f) => f a -> a Source #

product definition avoiding a clash with the Product monoid in base fixme: fit in with Product in base

class (MultiplicativeCommutative a, MultiplicativeUnital a, MultiplicativeAssociative a) => Multiplicative a where Source #

Multiplicative is commutative, associative and unital under multiplication

one * a == a
a * one == a
(a * b) * c == a * (b * c)
a * b == b * a

Methods

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

Instances

class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeRightCancellative a where Source #

Non-commutative right divide

a `times` recip a = one

Methods

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

class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeLeftCancellative a where Source #

Non-commutative left divide

recip a `times` a = one

Methods

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

class (Multiplicative a, MultiplicativeInvertible a) => MultiplicativeGroup a where Source #

Divide (/) is reserved for where both the left and right cancellative laws hold. This then implies that the MultiplicativeGroup is also Abelian.

a / a = one
recip a = one / a
recip a * a = one
a * recip a = one

Methods

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

class MultiplicativeMagma a => MultiplicativeIdempotent a Source #

Idempotent magma for multiplication.

a `times` a == a