Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
The Group hierarchy
Synopsis
- class Magma a where
- magma :: a -> a -> a
- class Magma a => Unital a where
- unit :: a
- class Magma a => Associative a
- class Magma a => Commutative a
- class Magma a => Absorbing a where
- absorb :: a
- class Magma a => Invertible a where
- inv :: a -> a
- class Magma a => Idempotent a
- class (Associative a, Unital a, Invertible a) => Group a
- class (Associative a, Unital a, Invertible a, Commutative a) => AbelianGroup a
Documentation
A Magma is a tuple (T,magma) consisting of
- a type a, and
- a function (magma) :: T -> T -> T
The mathematical laws for a magma are:
- magma is defined for all possible pairs of type T, and
- magma is closed in the set of all possible values of type T
or, more tersly,
∀ a, b ∈ T: a magma b ∈ T
These laws are true by construction in haskell: the type signature of magma
and the above mathematical laws are synonyms.
class Magma a => Unital a where Source #
A Unital Magma is a magma with an identity element (the unit).
unit magma a = a a magma unit = a
class Magma a => Associative a Source #
An Associative Magma
(a magma b) magma c = a magma (b magma c)
Instances
Associative b => Associative (a -> b) Source # | |
Defined in NumHask.Algebra.Abstract.Group |
class Magma a => Commutative a Source #
A Commutative Magma is a Magma where the binary operation is commutative.
a magma b = b magma a
Instances
Commutative b => Commutative (a -> b) Source # | |
Defined in NumHask.Algebra.Abstract.Group |
class Magma a => Absorbing a where Source #
An Absorbing is a Magma with an Absorbing Element
a `times` absorb = absorb
class Magma a => Invertible a where Source #
An Invertible Magma
∀ a,b ∈ T: inv a `magma` (a `magma` b) = b = (b `magma` a) `magma` inv a
Instances
Invertible b => Invertible (a -> b) Source # | |
Defined in NumHask.Algebra.Abstract.Group |
class Magma a => Idempotent a Source #
An Idempotent Magma is a magma where every element is Idempotent.
a magma a = a
Instances
Magma a => Idempotent (Wrapped a) Source # | |
Defined in NumHask.Data.Wrapped | |
Idempotent b => Idempotent (a -> b) Source # | |
Defined in NumHask.Algebra.Abstract.Group |
class (Associative a, Unital a, Invertible a) => Group a Source #
A Group is a Associative, Unital and Invertible Magma.
Instances
(Associative a, Unital a, Invertible a) => Group a Source # | |
Defined in NumHask.Algebra.Abstract.Group |
class (Associative a, Unital a, Invertible a, Commutative a) => AbelianGroup a Source #
An Abelian Group is an Associative, Unital, Invertible and Commutative Magma . In other words, it is a Commutative Group
Instances
(Associative a, Unital a, Invertible a, Commutative a) => AbelianGroup a Source # | |
Defined in NumHask.Algebra.Abstract.Group |