1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! [`Monoid`](monoid/trait.Monoid.html) trait and implementations
use ;
/// 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`
// impl<A, B> Monoid for (A, B)
// where
// A: Monoid,
// B: Monoid,
// {
// fn unit() -> Self {
// (A::unit(), B::unit())
// }
// fn join(&self, other: &Self) -> Self {
// (self.0.join(&other.0), self.1.join(&other.1))
// }
// }
/// Monoid formed by `Add::add` operation and `Default::default()` identity element
;