-
- Type Parameters:
A- the input argument typeM- theMonadunification parameterMB- the outputMonadtype
- 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 thisApplicativeandappB, discardingappB'sresult 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 aKleisliarrow.
-
-
-
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 thisApplicativeandappB, discardingappB'sresult and returning thisApplicative. This is generally useful for sequentially performing side-effects.- Specified by:
discardRin interfaceApplicative<A,B>- Specified by:
discardRin interfaceFn1<A,B>- Specified by:
discardRin interfaceMonad<A,B>- Specified by:
discardRin interfaceMonadReader<A,B,M extends Monad<?,M>>- Specified by:
discardRin interfaceMonadRec<A,B>- Specified by:
discardRin 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:
contraMapin interfaceCartesian<A,B,M extends Monad<?,M>>- Specified by:
contraMapin interfaceCocartesian<A,B,M extends Monad<?,M>>- Specified by:
contraMapin interfaceContravariant<A,B>- Specified by:
contraMapin interfaceFn1<A,B>- Specified by:
contraMapin 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:
diMapLin interfaceCartesian<A,B,M extends Monad<?,M>>- Specified by:
diMapLin interfaceCocartesian<A,B,M extends Monad<?,M>>- Specified by:
diMapLin interfaceFn1<A,B>- Specified by:
diMapLin 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>
-
-