Class MonoidLaws<A>
java.lang.Object
io.atlassian.fugue.law.MonoidLaws<A>
Laws for a monoid
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMonoidLaws(Monoid<A> monoid) Build a law instance to check monoid properties -
Method Summary
Modifier and TypeMethodDescriptionIf the zero of your monoid is combine with an element of the type your monoid works with the result should be that element.If an element of the type your monoid works with is combined with the zero of your monoid result should be that element.multiplyEqualRepeatedAppend(int n, A a) The multiply function of your monoid must be equal to the sum function called with an iterable containingncopies of the input type.semigroupAssociative(A x, A y, A z) A monoid must not care about the order elements are combined.sumEqualFold(Iterable<A> as) The sum function of your monoid must be equal toFunctions.fold(BiFunction, Object, Iterable)using append as the folding function and zero() as the initial value
-
Field Details
-
monoid
-
-
Constructor Details
-
MonoidLaws
-
-
Method Details
-
semigroupAssociative
A monoid must not care about the order elements are combined. If you combine x with y and then with z the result should be the same as combining y with z and then with x.- Parameters:
x- an A objecty- an A objectz- an A object- Returns:
- a
IsEqinstance where append(append(x,y),z) is equal to append(x, append(y,z))
-
monoidLeftIdentity
-
monoidRightIdentity
-
sumEqualFold
-
multiplyEqualRepeatedAppend
-