A
- A type.@FunctionalInterface public interface Semigroup<A>
A Semigroup is a type with an associative binary operation combine(Object, Object).
Given a type A
, instances of Semigroup should satisfy the following law:
combine(combine(x,y),z) == combine(x,combine(y,z))
for any x,y,z
of type
A
.Note: Technically a Semigroup is the same as a java.util.function.BiFunction<A,A,A>
. Introducing this new type
clarifies that the operation combine
is associative.
Modifier and Type | Method and Description |
---|---|
A |
combine(A a1,
A a2)
Combines two elements of the same type, which is also returned.
|
Copyright © 2016. All Rights Reserved.