Magma package:numhask

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 ⊕ b ∈ T
These laws are true by construction in haskell: the type signature of and the above mathematical laws are synonyms.