pub trait Monoid {
    fn unit() -> Self;
    fn join(&self, other: &Self) -> Self;
}
Expand description

Monoid definition

Monoid is a tuple of (S, O, I) where:

  • S - set of elements
  • O - binary operation on S S x S -> S, here called join
  • I - identity element of this monoid, here called unit

Every monoid implementation should satisfy following laws:

  • associativity: a + (b + c) == (a + b) + c
  • identity element: unit + a == a + unit == a

Required Methods§

unit or identity element of monoid

join operation of Monoid

Implementors§