Interface Semigroup<A>
-
- Type Parameters:
A- The element type this Semigroup is formed over
- All Superinterfaces:
Applicative<Fn1<A,A>,Fn1<A,?>>,Cartesian<A,Fn1<A,A>,Fn1<?,?>>,Cocartesian<A,Fn1<A,A>,Fn1<?,?>>,Contravariant<A,Profunctor<?,Fn1<A,A>,Fn1<?,?>>>,Fn1<A,Fn1<A,A>>,Fn2<A,A,A>,Functor<Fn1<A,A>,Fn1<A,?>>,Monad<Fn1<A,A>,Fn1<A,?>>,MonadReader<A,Fn1<A,A>,Fn1<A,?>>,MonadRec<Fn1<A,A>,Fn1<A,?>>,MonadWriter<A,Fn1<A,A>,Fn1<A,?>>,Profunctor<A,Fn1<A,A>,Fn1<?,?>>
- All Known Subinterfaces:
Monoid<A>
- All Known Implementing Classes:
And,Concat,Endo,First,Intersection,Join,Last,Max,MergeHMaps,Min,Or,PutAll,Trivial,Union,Xor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Semigroup<A> extends Fn2<A,A,A>
ASemigroupis a closed, associative category. As closure can be implied by the type signature, and associativity is not enforceable, this is simply represented as a binary operator.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Semigroup<A>flip()Flip the order of the arguments.default AfoldLeft(A a, java.lang.Iterable<A> as)Catamorphism under this semigroup usingFoldLeft, where the binary operator is this semigroup, and the starting accumulator is provided.default Lazy<A>foldRight(A a, java.lang.Iterable<A> as)Catamorphism under this semigroup usingFoldRight, where the binary operator is this semigroup, and the starting accumulator is provided.-
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn2
apply, apply, checkedApply, checkedApply, compose, contraMap, diMapL, discardR, toBiFunction, uncurry, widen
-
-
-
-
Method Detail
-
foldLeft
default A foldLeft(A a, java.lang.Iterable<A> as)
Catamorphism under this semigroup usingFoldLeft, where the binary operator is this semigroup, and the starting accumulator is provided.- Parameters:
a- the starting accumulatoras- the elements to fold over- Returns:
- the folded result
- See Also:
FoldLeft
-
foldRight
default Lazy<A> foldRight(A a, java.lang.Iterable<A> as)
Catamorphism under this semigroup usingFoldRight, where the binary operator is this semigroup, and the starting accumulator is provided.- Parameters:
a- the starting accumulatoras- the elements to fold over- Returns:
- the folded result
- See Also:
FoldRight
-
-