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.