Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- class Semiring a where
Documentation
class Semiring a where Source #
A Semiring is like the
the combination of two Monoid
s. The first
is called +
; it has the identity element zero
, and it is
commutative. The second is called *
; it has identity element one
,
and it must distribute over +
.
Laws
Normal Monoid
laws
Commutativity of +
Distribution of *
over +
Another useful law, annihilation, may be deduced from the axioms above:
The identity of *
.
The identity of +
.
(*) :: a -> a -> a infixl 7 Source #
An associative binary operation, which distributes over +
.
(+) :: a -> a -> a infixl 6 Source #
An associative, commutative binary operation.
The identity of *
.
The identity of +
.
(+) :: Num a => a -> a -> a infixl 6 Source #
An associative, commutative binary operation.
(*) :: Num a => a -> a -> a infixl 7 Source #
An associative binary operation, which distributes over +
.