A semiring extends a commutative Monoid with operation <.> that acts similarly to multiplication over the underlying (additive) monoid and has one as the identity. This module also provides two convenient aliases: zero for mempty, and <+> for <>, which makes the interface more uniform.
Instances of this type class must satisfy the following semiring laws:
x <+> (y <+> z) == (x <+> y) <+> z x <.> (y <.> z) == (x <.> y) <.> zzero <+> x == x == x <+> zero one <.> x == x == x <.> oneCommutativity of <+>:
x <+> y == y <+> xAnnihilating zero:
x <.> zero == zero zero <.> x == zeroDistributivity:
x <.> (y <+> z) == x <.> y <+> x <.> z (x <+> y) <.> z == x <.> z <+> y <.> z
Instances8Semiring, …
Semiring AnyDefined in algebraic-graphs-0.8 · Algebra.Graph.LabelSemiring (Label a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Monoid a, Ord a) => Semiring (Minimum a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Monoid a, Ord a) => Semiring (PowerSet a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Num a, Ord a) => Semiring (Capacity a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Num a, Ord a) => Semiring (Count a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Num a, Ord a) => Semiring (Distance a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label(Eq o, Semiring a, Semiring o) => Semiring (Optimum o a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Label