public final class SemigroupLaws<A> extends Object
| Constructor and Description |
|---|
SemigroupLaws(Semigroup<A> semigroup)
Build a law instance to check semigroup properties
|
| Modifier and Type | Method and Description |
|---|---|
IsEq<A> |
multiply1pEqualRepeatedAppend(int n,
A a)
The
Semigroup.multiply1p(int, Object) function of your semigroup
must be equal to Semigroup.sumNonEmpty(Object, Iterable) applied to
the input and an iterable containing n - 1 copies of that input |
IsEq<A> |
semigroupAssociative(A x,
A y,
A z)
A semigroup must not care about the order elements are combined.
|
IsEq<A> |
sumNonEmptyEqualFold(A head,
Iterable<A> tail)
The
Semigroup.sumNonEmpty(Object, Iterable) function of your
semigroup must be equal to a
Functions.fold(BiFunction, Object, Iterable) where append is used
as the combining function, head is used as the initial value and tail is
the iterable to check |
public IsEq<A> semigroupAssociative(A x, A y, A z)
x - an A objecty - an A objectz - an A objectIsEq instance where
append(append(x,y),z) is equal to append(x, append(y,z))public IsEq<A> sumNonEmptyEqualFold(A head, Iterable<A> tail)
Semigroup.sumNonEmpty(Object, Iterable) function of your
semigroup must be equal to a
Functions.fold(BiFunction, Object, Iterable) where append is used
as the combining function, head is used as the initial value and tail is
the iterable to checkpublic IsEq<A> multiply1pEqualRepeatedAppend(int n, A a)
Semigroup.multiply1p(int, Object) function of your semigroup
must be equal to Semigroup.sumNonEmpty(Object, Iterable) applied to
the input and an iterable containing n - 1 copies of that inputn - a int representing the number of copies of the input to combinea - an AIsEq where multiply(n,a) is equal
to sumNonEmpty(a, take(n-1, cycle(a))Copyright © 2018 Atlassian. All rights reserved.