Module Alg_structs.Semigroup
An interface for a type with a binary, associative operator over it.
"A semigroup is an algebraic structure consisting of a set together with an associative binary operation" (wikipedia).
"The term 'semigroup' is standard, but semi-monoid would be more systematic." ncatlab
Modules that implement the semigroup interface are a structural subtype of the better known Monoids interface. Semigroups are differentiated from Monoids by the absence of a unit (or identity) element. in their specification.
Seed
Interface
module type S = sig ... end
A semigroup is a set of objects with an associative binary operation over it
module type S1 = sig ... end
Laws
Constructors
Functions and module functors for creating implementations of Semigroups
Implementations
module Bool : sig ... end
Semigroups over
bool
module Int : sig ... end
Semigroups over
int
module Option : sig ... end
Semigroups over option types
module Endo : sig ... end
Endo
is a semigroup where the operator is the composition of functions with input and output of the same type.
module Dual : sig ... end
Dual
allows constructing the dual semigroup for a given semigroup. I.e., a semigroup with the arguments of it's operator reversed.