An additive monad is a monad with an operation for combining monadic values and an identity value, conventionally called MZero. Binding a computation to MZero produces MZero, so additive structure can represent alternatives, impossibility, or absence. section 11.4 section 14.2
The pattern requires three related capabilities:
- Add two values of type M<T> to produce another M<T>. section 11.4
- Provide MZero as the additive identity. section 14.2
- Ensure Bind applied to MZero remains MZero. section 11.5
Sequences and probability distributions
For sequences, concatenation acts as addition and the empty sequence is MZero. A predicate can therefore retain an item by returning a singleton sequence or discard it by returning an empty sequence; the direct implementation is clearer and more efficient, but the monadic version exposes the general pattern. Discrete probability distributions provide a less obvious example: distributions can be merged, while an empty distribution represents an outcome that is impossible. Supporting that value requires constructors and joint-distribution logic to handle zero total weight. section 11.4 section 14.2
