Semiring is a set equipped with two binary operations, called "addition" and "multiplication". The intuition that works here is such of natural numbers – you can define a semiring for Nat with addition as "+" and multiplication as "*"
Rings and semirings must also have "zero" and "one" elements, and multiplication should distribute over addition.
Recap: monoid is defined using two operations:
- combine :: A×A → A, which merges two monoids together,
- empty :: A, which defines an entity for "one".
- set of languages form a semiring with product as string concatenation and addition as set union;
- boolean logic naturally forms a semiring: (Boolean, &&, ||, true, false).
lukajcb.github.io/blog/functiona…