- 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 a
Monad, manifest as simply an Fn1<A, MB>. This can be
thought of as a fixed, portable Monad.flatMap(Fn1).-
Method Summary
Modifier and TypeMethodDescriptionContravariantly mapA <- B.Contravariantly map over the argument to this function, producing a function that takes the new argument type, and produces the same result.discardR(Applicative<C, Fn1<A, ?>> appB) Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative.Adapt a compatible function into aKleisliarrow.
-
Method Details
-
andThen
-
compose
-
discardR
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
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
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>
-
kleisli
-