higher_cat/
monoid.rs

1use std::ops::Add;
2
3/// A `Monoid` consists of a semigroup (the [`Add`][Add] trait in Rust) and an
4/// empty value (the [`Default`][Default] trait) plus the following laws:
5///
6/// - Associativity: `(x + y) + z == x + (y + z)`
7/// - Identity: `0 + a == a + 0 == a`
8///
9/// [Add]: https://doc.rust-lang.org/std/ops/trait.Add.html
10/// [Default]: https://doc.rust-lang.org/std/default/trait.Default.html
11pub trait Monoid: Add + Default {}