-
- Type Parameters:
A
- the input argument typeM
- theMonad
unification parameterMB
- the outputMonad
type
- All Superinterfaces:
Applicative<MB,Fn1<A,?>>
,Cartesian<A,MB,Fn1<?,?>>
,Cocartesian<A,MB,Fn1<?,?>>
,Contravariant<A,Profunctor<?,MB,Fn1<?,?>>>
,Fn1<A,MB>
,Functor<MB,Fn1<A,?>>
,Monad<MB,Fn1<A,?>>
,MonadReader<A,MB,Fn1<A,?>>
,MonadRec<MB,Fn1<A,?>>
,MonadWriter<A,MB,Fn1<A,?>>
,Profunctor<A,MB,Fn1<?,?>>
- 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 Kleisli<A,B,M extends Monad<?,M>,MB extends Monad<B,M>> extends Fn1<A,MB>
The Kleisli arrow of aMonad
, manifest as simply an
. This can be thought of as a fixed, portableFn1
<A, MB>Monad.flatMap(Fn1)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default <C,MC extends Monad<C,M>>
Kleisli<A,C,M,MC>andThen(Kleisli<B,C,M,MC> after)
default <Z,MA extends Monad<A,M>>
Kleisli<Z,B,M,MB>compose(Kleisli<Z,A,M,MA> before)
default <Z> Kleisli<Z,B,M,MB>
contraMap(Fn1<? super Z,? extends A> fn)
Contravariantly mapA <- 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 thisApplicative
andappB
, discardingappB's
result and returning thisApplicative
.static <A,B,M extends Monad<?,M>,MB extends Monad<B,M>>
Kleisli<A,B,M,MB>kleisli(Fn1<? super A,? extends MB> fn)
Adapt a compatible function into aKleisli
arrow.
-
-
-
Method Detail
-
andThen
default <C,MC extends Monad<C,M>> Kleisli<A,C,M,MC> andThen(Kleisli<B,C,M,MC> after)
-
compose
default <Z,MA extends Monad<A,M>> Kleisli<Z,B,M,MB> compose(Kleisli<Z,A,M,MA> before)
-
discardR
default <C> Kleisli<A,B,M,MB> discardR(Applicative<C,Fn1<A,?>> appB)
Sequence both thisApplicative
andappB
, discardingappB's
result and returning thisApplicative
. This is generally useful for sequentially performing side-effects.- Specified by:
discardR
in interfaceApplicative<A,B>
- Specified by:
discardR
in interfaceFn1<A,B>
- Specified by:
discardR
in interfaceMonad<A,B>
- Specified by:
discardR
in interfaceMonadReader<A,B,M extends Monad<?,M>>
- Specified by:
discardR
in interfaceMonadRec<A,B>
- Specified by:
discardR
in interfaceMonadWriter<A,B,M extends Monad<?,M>>
- Type Parameters:
C
- the type of appB's parameter- Parameters:
appB
- the other Applicative- Returns:
- this Applicative
-
contraMap
default <Z> Kleisli<Z,B,M,MB> contraMap(Fn1<? super Z,? extends A> fn)
Contravariantly mapA <- B
.- Specified by:
contraMap
in interfaceCartesian<A,B,M extends Monad<?,M>>
- Specified by:
contraMap
in interfaceCocartesian<A,B,M extends Monad<?,M>>
- Specified by:
contraMap
in interfaceContravariant<A,B>
- Specified by:
contraMap
in interfaceFn1<A,B>
- Specified by:
contraMap
in interfaceProfunctor<A,B,M extends Monad<?,M>>
- Type Parameters:
Z
- the new parameter type- Parameters:
fn
- the mapping function- Returns:
- the mapped Contravariant functor instance
-
diMapL
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.- Specified by:
diMapL
in interfaceCartesian<A,B,M extends Monad<?,M>>
- Specified by:
diMapL
in interfaceCocartesian<A,B,M extends Monad<?,M>>
- Specified by:
diMapL
in interfaceFn1<A,B>
- Specified by:
diMapL
in interfaceProfunctor<A,B,M extends Monad<?,M>>
- Type Parameters:
Z
- the new argument type- Parameters:
fn
- the contravariant argument mapping function- Returns:
- an
Fn1
<Z, B>
-
-