JavaScript is disabled on your browser.
Type Parameters:
A
- the element type this Monoid 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 <?,?>>
, Semigroup <A>
All Known Implementing Classes:
And
, Concat
, Endo
, First
, Join
, Last
, MergeHMaps
, Or
, PutAll
, Trivial
, Union
, Xor
public interface Monoid<A>
extends Semigroup <A>
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods
Flip the order of the arguments.
Catamorphism under this semigroup using
FoldLeft
, where the binary operator is this semigroup, and the
starting accumulator is provided.
Homomorphism combined with catamorphism.
Catamorphism under this semigroup using
FoldRight
, where the binary operator is this semigroup, and the
starting accumulator is provided.
The identity element of this monoid.
Catamorphism under this monoid using
ReduceLeft
, where the result is the reduction, or, if empty, the
identity of this monoid.
Catamorphism under this monoid using
ReduceRight
, where the result is the reduction, or, if empty, the
identity of this monoid.
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
Methods inherited from interface com.jnape.palatable.lambda.functor.Functor
coerce
Method Details
identity
The identity element of this monoid.
Returns:
the identity
reduceLeft
Catamorphism under this monoid using
ReduceLeft
, where the result is the reduction, or, if empty, the
identity of this monoid.
Parameters:
as
- the elements to reduce
Returns:
the reduction, or identity()
if empty
See Also:
reduceRight
Catamorphism under this monoid using
ReduceRight
, where the result is the reduction, or, if empty, the
identity of this monoid.
Parameters:
as
- an Iterable of elements in this monoid
Returns:
the reduction, or identity()
if empty
See Also:
foldMap
default <B> A foldMap (Fn1 <? super B,? extends A > fn,
Iterable <B> bs)
Homomorphism combined with catamorphism. Convert an Iterable<B>
to an
Iterable<A>
(that is, an Iterable
of elements this monoid is formed over), then
reduce the result from left to right. Under algebraic data types, this is isomorphic to a flatMap.
Type Parameters:
B
- the input Iterable element type
Parameters:
fn
- the mapping function from A to B
bs
- the Iterable of Bs
Returns:
the folded result under this Monoid
See Also:
foldLeft
Catamorphism under this semigroup using
FoldLeft
, where the binary operator is this semigroup, and the
starting accumulator is provided.
Specified by:
foldLeft
in interface Semigroup <A >
Parameters:
a
- the starting accumulator
as
- the elements to fold over
Returns:
the folded result
See Also:
foldRight
Catamorphism under this semigroup using
FoldRight
, where the binary operator is this semigroup, and the
starting accumulator is provided.
Specified by:
foldRight
in interface Semigroup <A >
Parameters:
a
- the starting accumulator
as
- the elements to fold over
Returns:
the folded result
See Also:
flip
Flip the order of the arguments.
Specified by:
flip
in interface Fn2 <A ,A ,A >
Specified by:
flip
in interface Semigroup <A >
Returns:
an Fn2
<B, A, C>
monoid
Type Parameters:
A
- the element type of this monoid
Parameters:
semigroup
- the semigroup
identity
- the identity element
Returns:
the monoid