HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Package0.7AlgebraDataData StructuresMathMathsMathematics

semirings

two monoids as one, in holy haskimony

Modules

8 modules
  • Data.Euclidean6
  • Data.Field5A Field is a Ring in which all nonzero elements
  • Data.Ring.Ordered2An 'ordered ring' is a ring with a total order. Mathematical pedantry note Many (if not most) of the instances of the OrderedRing type cl…
  • Data.Semiring23A class for semirings (types with two binary operations, one commutative and one associative, and two respective identities), with variou…
  • Data.Semiring.Directed1A "directed semiring" refers to the semiring composed of the union of upwards
  • Data.Semiring.Generic9This module provides generic deriving tools for semirings and rings for
  • Data.Semiring.Tropical4A tropical semiring is an extension of another totally ordered
  • Data.Star1A class for *-semirings (pron. "star-semirings").

Description

Haskellers are usually familiar with monoids and semigroups. A monoid has an appending operation <> (or mappend), and an identity element, mempty. A semigroup has an appending <> operation, but does not require a mempty element.

A Semiring has two appending operations, plus and times, and two respective identity elements, zero and one.

More formally, a Semiring R is a set equipped with two binary relations + and *, such that:

(R,+) is a commutative monoid with identity element 0,

(R,*) is a monoid with identity element 1,

(*) left and right distributes over addition, and

multiplication by '0' annihilates R.

Depends on

4 packages

Used by in this set · 2