Max Monoid
data class MaxMonoid<A : Comparable<A>>(val value: Maybe<A>) : Monoid<Maybe<A>, MaxMonoid<A>> , Band<Maybe<A>, MaxMonoid<A>> (source)
Monoid that keeps the maximum value, with Maybe.None as identity (no bounded type needed). Also a Band.
On ties the left operand is kept.
val clazz = MaxMonoid::class.java as Class<MaxMonoid<Int>>
Monoid.op(clazz, Maybe.Just(1).toMaxMonoid(), Maybe.Just(3).toMaxMonoid()) // MaxMonoid(Just(3))Content copied to clipboard