W
- the accumulation typeA
- the output typeMW
- the witnesspublic interface MonadWriter<W,A,MW extends MonadWriter<W,?,MW>> extends Monad<A,MW>
Monad
that is capable of writing and accumulating state alongside a value, but is not necessarily capable
of simultaneously accessing the state and the value.Modifier and Type | Method and Description |
---|---|
MonadWriter<W,A,MW> |
censor(Fn1<? super W,? extends W> fn)
Update the accumulated state.
|
default <B> MonadWriter<W,B,MW> |
discardL(Applicative<B,MW> appB)
Sequence both this
Applicative and appB , discarding this Applicative's
result and returning appB . |
default <B> MonadWriter<W,A,MW> |
discardR(Applicative<B,MW> appB)
Sequence both this
Applicative and appB , discarding appB's result and
returning this Applicative . |
<B> MonadWriter<W,B,MW> |
flatMap(Fn1<? super A,? extends Monad<B,MW>> f)
Chain dependent computations that may continue or short-circuit based on previous results.
|
default <B> MonadWriter<W,B,MW> |
fmap(Fn1<? super A,? extends B> fn)
Covariantly transmute this functor's parameter using the given mapping function.
|
default <B> Lazy<? extends MonadWriter<W,B,MW>> |
lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,MW>> lazyAppFn)
Given a
lazy instance of this applicative over a mapping function, "zip" the two instances together
using whatever application semantics the current applicative supports. |
<B> MonadWriter<W,Tuple2<A,B>,MW> |
listens(Fn1<? super W,? extends B> fn)
Map the accumulation into a value and pair it with the current output.
|
<B> MonadWriter<W,B,MW> |
pure(B b)
Lift the value
b into this applicative functor. |
default <B> MonadWriter<W,B,MW> |
zip(Applicative<Fn1<? super A,? extends B>,MW> appFn)
Given another instance of this applicative over a mapping function, "zip" the two instances together using
whatever application semantics the current applicative supports.
|
<B> MonadWriter<W,Tuple2<A,B>,MW> listens(Fn1<? super W,? extends B> fn)
B
- the mapped outputfn
- the mapping functionMonadWriter
MonadWriter<W,A,MW> censor(Fn1<? super W,? extends W> fn)
fn
- the update functionMonadWriter
<B> MonadWriter<W,B,MW> flatMap(Fn1<? super A,? extends Monad<B,MW>> f)
<B> MonadWriter<W,B,MW> pure(B b)
b
into this applicative functor.pure
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
pure
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the type of the returned applicative's parameterb
- the valuedefault <B> MonadWriter<W,B,MW> fmap(Fn1<? super A,? extends B> fn)
fmap
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
fmap
in interface Functor<A,MW extends MonadWriter<W,?,MW>>
fmap
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the new parameter typefn
- the mapping functiondefault <B> MonadWriter<W,B,MW> zip(Applicative<Fn1<? super A,? extends B>,MW> appFn)
zip
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
zip
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the resulting applicative parameter typeappFn
- the other applicative instancedefault <B> Lazy<? extends MonadWriter<W,B,MW>> lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,MW>> lazyAppFn)
lazy
instance of this applicative over a mapping function, "zip" the two instances together
using whatever application semantics the current applicative supports. This is useful for applicatives that
support lazy evaluation and early termination.lazyZip
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
lazyZip
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the resulting applicative parameter typelazyAppFn
- the lazy other applicative instanceMaybe
,
Either
default <B> MonadWriter<W,B,MW> discardL(Applicative<B,MW> appB)
Applicative
and appB
, discarding this Applicative's
result and returning appB
. This is generally useful for sequentially performing side-effects.discardL
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
discardL
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the type of the returned Applicative's parameterappB
- the other Applicativedefault <B> MonadWriter<W,A,MW> discardR(Applicative<B,MW> appB)
Applicative
and appB
, discarding appB's
result and
returning this Applicative
. This is generally useful for sequentially performing side-effects.discardR
in interface Applicative<A,MW extends MonadWriter<W,?,MW>>
discardR
in interface Monad<A,MW extends MonadWriter<W,?,MW>>
B
- the type of appB's parameterappB
- the other Applicative