Change Leaf0 and Branch0 to be a case class.
Add M type parameter.
Introduce M: Monoid type parameter.
Replace HasMonoid with "<% M" view bound.