arrow-mtl-data / arrow.mtl / Kleisli

Kleisli

@higherkind class Kleisli<F, D, A>

Kleisli represents a function parameter from D to a value Kind<F, A>.

Parameters

F - the context of the result.

D - the dependency or environment we depend on.

A - resulting type of the computation.

Properties

run the arrow from D to Kind<F, A>.val run: (D) -> Kind<F, A>

Functions

andThen Compose with another Kleisli.fun <C> andThen(MF: Monad<F>, o: Kleisli<F, A, C>): Kleisli<F, D, C>
Compose with a function to transform the output of the Kleisli arrow.fun <B> andThen(MF: Monad<F>, f: (A) -> Kind<F, B>): Kleisli<F, D, B>
Set the end of the arrow to Kind<F, B> after running the computation.fun <B> andThen(MF: Monad<F>, fb: Kind<F, B>): Kleisli<F, D, B>
ap Apply a function (A) -> B that operates within the Kleisli context.fun <B> ap(AF: Apply<F>, ff: <ERROR CLASS><F, D, (A) -> B>): Kleisli<F, D, B>
flatMap FlatMap the end of the arrow A to another Kleisli arrow for the same start D and context F.fun <B> flatMap(MF: Monad<F>, f: (A) -> <ERROR CLASS><F, D, B>): Kleisli<F, D, B>
handleErrorWith Handle error within context of F given a ApplicativeError is defined for F.fun <E> handleErrorWith(AE: ApplicativeError<F, E>, f: (E) -> <ERROR CLASS><F, D, A>): Kleisli<F, D, A>
local Compose this arrow with another function to transform the input of the arrow.fun <DD> local(f: (DD) -> D): Kleisli<F, DD, A>
map Map the end of the arrow A to B given a function f.fun <B> map(FF: Functor<F>, f: (A) -> B): Kleisli<F, D, B>
zip Zip with another Kleisli arrow.fun <B> zip(MF: Monad<F>, o: <ERROR CLASS><F, D, B>): Kleisli<F, D, Tuple2<A, B>>

Companion Object Functions

ask Ask an arrow from D to D.fun <F, D> ask(AF: Applicative<F>): Kleisli<F, D, D>
invoke Constructor to create Kleisli<F, D, A> given a KleisliFun.operator fun <F, D, A> invoke(run: (D) -> Kind<F, A>): Kleisli<F, D, A>
just Create an arrow for a value of A.fun <F, D, A> just(AF: Applicative<F>, x: A): Kleisli<F, D, A>
liftF Lift a value of F into Kleislifun <F, D, A> liftF(fa: Kind<F, A>): Kleisli<F, D, A>
raiseError Raise an error E.fun <F, D, E, A> raiseError(AE: ApplicativeError<F, E>, e: E): Kleisli<F, D, A>
tailRecM Tail recursive function that keeps calling f until Either.Right is returned.fun <F, D, A, B> tailRecM(MF: Monad<F>, a: A, f: (A) -> <ERROR CLASS><F, D, Either<A, B>>): Kleisli<F, D, B>

Extension Functions

andThen Compose with another Reader that has a dependency on the output of the computation.fun <D, A, C> Reader<D, A>.andThen(o: Reader<A, C>): Reader<D, C>
Map the result of the computation A to B given a function f. Alias for mapfun <D, A, B> Reader<D, A>.andThen(f: (A) -> B): Reader<D, B>
Set the result to B after running the computation.fun <D, A, B> Reader<D, A>.andThen(b: B): Reader<D, B>
ap Apply a function (A) -> B that operates within the context of Reader.fun <D, A, B> Reader<D, A>.ap(ff: <ERROR CLASS><F, D, A>): Reader<D, B>
flatMap FlatMap the result of the computation A to another Reader for the same dependency D and flatten the structure.fun <D, A, B> Reader<D, A>.flatMap(f: (A) -> Reader<D, B>): Reader<D, B>
map Map the result of the computation A to B given a function f.fun <D, A, B> Reader<D, A>.map(f: (A) -> B): Reader<D, B>
runId Alias for Kleisli.runfun <D, A> Reader<D, A>.runId(d: D): A
toAccumT Convert a read-only computation into an accumulation computation.fun <F, S, A> ReaderT<F, S, A>.toAccumT(FF: Functor<F>, MS: Monoid<S>): AccumT<S, F, A>
zip Zip with another Reader.fun <D, A, B> Reader<D, A>.zip(o: Reader<D, B>): Reader<D, Tuple2<A, B>>

Do you like Arrow?

Arrow Org
<