algebra-0.3.0: Constructive abstract algebra

Numeric.Semiring.Class

Synopsis

# Documentation

class (Additive r, Abelian r, Multiplicative r) => Semiring r Source

A pair of an additive abelian semigroup, and a multiplicative semigroup, with the distributive laws:

``` a(b + c) = ab + ac
(a + b)c = ac + bc
```

Common notation includes the laws for additive and multiplicative identity in semiring.

If you want that, look at `Rig` instead.

Ideally we'd use the cyclic definition:

``` class (LeftModule r r, RightModule r r, Additive r, Abelian r, Multiplicative r) => Semiring r
```

to enforce that every semiring r is an r-module over itself, but Haskell doesn't like that.

Instances

 Semiring Bool Semiring Int Semiring Int8 Semiring Int16 Semiring Int32 Semiring Int64 Semiring Integer Semiring Word Semiring Word8 Semiring Word16 Semiring Word32 Semiring Word64 Semiring () Semiring Natural (Abelian r, AdditiveMonoid r) => Semiring (End r) (AdditiveMonoid r, Abelian r) => Semiring (ZeroRng r) Semiring r => Semiring (Opposite r) Rng r => Semiring (RngRing r) FreeAlgebra r a => Semiring (a -> r) (Semiring a, Semiring b) => Semiring (a, b) FreeCoalgebra r m => Semiring (Linear r m) (Semiring a, Semiring b, Semiring c) => Semiring (a, b, c) FreeCoalgebra r m => Semiring (Map r b m) (Semiring a, Semiring b, Semiring c, Semiring d) => Semiring (a, b, c, d) (Semiring a, Semiring b, Semiring c, Semiring d, Semiring e) => Semiring (a, b, c, d, e)