Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A magma heirarchy for multiplication. The basic magma structure is repeated and prefixed with 'Multiplicative-'.
- class MultiplicativeMagma a where
- class MultiplicativeMagma a => MultiplicativeUnital a where
- class MultiplicativeMagma a => MultiplicativeAssociative a
- class MultiplicativeMagma a => MultiplicativeCommutative a
- class MultiplicativeMagma a => MultiplicativeInvertible a where
- product :: (Multiplicative a, Foldable f) => f a -> a
- class (MultiplicativeCommutative a, MultiplicativeUnital a, MultiplicativeAssociative a) => Multiplicative a where
- class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeRightCancellative a where
- class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeLeftCancellative a where
- class (Multiplicative a, MultiplicativeInvertible a) => MultiplicativeGroup a where
Documentation
class MultiplicativeMagma a where Source #
class MultiplicativeMagma a => MultiplicativeUnital a where Source #
Unital magma for multiplication.
one `times` a == a a `times` one == a
class MultiplicativeMagma a => MultiplicativeAssociative a Source #
Associative magma for multiplication.
(a `times` b) `times` c == a `times` (b `times` c)
class MultiplicativeMagma a => MultiplicativeCommutative a Source #
Commutative magma for multiplication.
a `times` b == b `times` a
class MultiplicativeMagma a => MultiplicativeInvertible a where Source #
Invertible magma for multiplication.
∀ a ∈ A: recip a ∈ A
law is true by construction in Haskell
product :: (Multiplicative a, Foldable f) => f a -> a Source #
product definition avoiding a clash with the Product monoid 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
class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeRightCancellative a where Source #
Non-commutative right divide
a `times` recip a = one
class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeLeftCancellative a where Source #
Non-commutative left divide
recip a `times` a = one
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