R
- the environmentA
- the outputMR
- the witnesspublic interface MonadReader<R,A,MR extends MonadReader<R,?,MR>> extends Monad<A,MR>
R
and producing a lifted value A
. This
is strictly less powerful than an Fn1
, loosening the requirement on Contravariant
(and therefore
Profunctor
constraints), so is more generally applicable, offering instead a local(Fn1)
mechanism for modifying the environment *after* reading it but before running the effect (as opposed to
Contravariant
functors which may modify their inputs *before* running their effects, and may therefore alter
the input types).Modifier and Type | Method and Description |
---|---|
default <B> MonadReader<R,B,MR> |
discardL(Applicative<B,MR> appB)
Sequence both this
Applicative and appB , discarding this Applicative's
result and returning appB . |
default <B> MonadReader<R,A,MR> |
discardR(Applicative<B,MR> appB)
Sequence both this
Applicative and appB , discarding appB's result and
returning this Applicative . |
<B> MonadReader<R,B,MR> |
flatMap(Fn1<? super A,? extends Monad<B,MR>> f)
Chain dependent computations that may continue or short-circuit based on previous results.
|
default <B> MonadReader<R,B,MR> |
fmap(Fn1<? super A,? extends B> fn)
Covariantly transmute this functor's parameter using the given mapping function.
|
default <B> Lazy<? extends MonadReader<R,B,MR>> |
lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,MR>> 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. |
MonadReader<R,A,MR> |
local(Fn1<? super R,? extends R> fn)
Modify this
MonadReader's environment after reading it but before running the effect. |
<B> MonadReader<R,B,MR> |
pure(B b)
Lift the value
b into this applicative functor. |
default <B> MonadReader<R,B,MR> |
zip(Applicative<Fn1<? super A,? extends B>,MR> appFn)
Given another instance of this applicative over a mapping function, "zip" the two instances together using
whatever application semantics the current applicative supports.
|
MonadReader<R,A,MR> local(Fn1<? super R,? extends R> fn)
MonadReader's
environment after reading it but before running the effect.fn
- the modification functionMonadReader
with a modified environment<B> MonadReader<R,B,MR> flatMap(Fn1<? super A,? extends Monad<B,MR>> f)
<B> MonadReader<R,B,MR> pure(B b)
b
into this applicative functor.pure
in interface Applicative<A,MR extends MonadReader<R,?,MR>>
pure
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the type of the returned applicative's parameterb
- the valuedefault <B> MonadReader<R,B,MR> fmap(Fn1<? super A,? extends B> fn)
fmap
in interface Applicative<A,MR extends MonadReader<R,?,MR>>
fmap
in interface Functor<A,MR extends MonadReader<R,?,MR>>
fmap
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the new parameter typefn
- the mapping functiondefault <B> MonadReader<R,B,MR> zip(Applicative<Fn1<? super A,? extends B>,MR> appFn)
zip
in interface Applicative<A,MR extends MonadReader<R,?,MR>>
zip
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the resulting applicative parameter typeappFn
- the other applicative instancedefault <B> Lazy<? extends MonadReader<R,B,MR>> lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,MR>> 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,MR extends MonadReader<R,?,MR>>
lazyZip
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the resulting applicative parameter typelazyAppFn
- the lazy other applicative instanceMaybe
,
Either
default <B> MonadReader<R,B,MR> discardL(Applicative<B,MR> 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,MR extends MonadReader<R,?,MR>>
discardL
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the type of the returned Applicative's parameterappB
- the other Applicativedefault <B> MonadReader<R,A,MR> discardR(Applicative<B,MR> 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,MR extends MonadReader<R,?,MR>>
discardR
in interface Monad<A,MR extends MonadReader<R,?,MR>>
B
- the type of appB's parameterappB
- the other Applicative