A
- the input argument typeM
- the Monad
unification parameterMB
- the output Monad
type@FunctionalInterface public interface Kleisli<A,B,M extends Monad<?,M>,MB extends Monad<B,M>> extends Fn1<A,MB>
Monad
, manifest as simply an Fn1
<A, MB>
. This can be
thought of as a fixed, portable Monad.flatMap(Fn1)
.Modifier and Type | Method and Description |
---|---|
default <C,MC extends Monad<C,M>> |
andThen(Kleisli<B,C,M,MC> after)
|
default <Z,MA extends Monad<A,M>> |
compose(Kleisli<Z,A,M,MA> before)
|
default <Z> Kleisli<Z,B,M,MB> |
contraMap(Fn1<? super Z,? extends A> fn)
Contravariantly map
A <- B . |
default <Z> Kleisli<Z,B,M,MB> |
diMapL(Fn1<? super Z,? extends A> fn)
Contravariantly map over the argument to this function, producing a function that takes the new argument type,
and produces the same result.
|
default <C> Kleisli<A,B,M,MB> |
discardR(Applicative<C,Fn1<A,?>> appB)
Sequence both this
Applicative and appB , discarding appB's result and
returning this Applicative . |
static <A,B,M extends Monad<?,M>,MB extends Monad<B,M>> |
kleisli(Fn1<? super A,? extends MB> fn)
Adapt a compatible function into a
Kleisli arrow. |
andThen, apply, carry, cartesian, censor, checkedApply, choose, cocartesian, compose, diMap, diMapR, discardL, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, widen, zip, zip
default <C> Kleisli<A,B,M,MB> discardR(Applicative<C,Fn1<A,?>> 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<MB extends Monad<B,M>,Fn1<A,?>>
discardR
in interface Fn1<A,MB extends Monad<B,M>>
discardR
in interface Monad<MB extends Monad<B,M>,Fn1<A,?>>
discardR
in interface MonadReader<A,MB extends Monad<B,M>,Fn1<A,?>>
discardR
in interface MonadRec<MB extends Monad<B,M>,Fn1<A,?>>
discardR
in interface MonadWriter<A,MB extends Monad<B,M>,Fn1<A,?>>
C
- the type of appB's parameterappB
- the other Applicativedefault <Z> Kleisli<Z,B,M,MB> contraMap(Fn1<? super Z,? extends A> fn)
A <- B
.contraMap
in interface Cartesian<A,MB extends Monad<B,M>,Fn1<?,?>>
contraMap
in interface Cocartesian<A,MB extends Monad<B,M>,Fn1<?,?>>
contraMap
in interface Contravariant<A,Profunctor<?,MB extends Monad<B,M>,Fn1<?,?>>>
contraMap
in interface Fn1<A,MB extends Monad<B,M>>
contraMap
in interface Profunctor<A,MB extends Monad<B,M>,Fn1<?,?>>
Z
- the new parameter typefn
- the mapping functiondefault <Z> Kleisli<Z,B,M,MB> diMapL(Fn1<? super Z,? extends A> fn)
diMapL
in interface Cartesian<A,MB extends Monad<B,M>,Fn1<?,?>>
diMapL
in interface Cocartesian<A,MB extends Monad<B,M>,Fn1<?,?>>
diMapL
in interface Fn1<A,MB extends Monad<B,M>>
diMapL
in interface Profunctor<A,MB extends Monad<B,M>,Fn1<?,?>>
Z
- the new argument typefn
- the contravariant argument mapping functionFn1
<Z, B>