Interface Kleisli<A,​B,​M extends Monad<?,​M>,​MB extends Monad<B,​M>>

    • Method Detail

      • andThen

        default <C,​MC extends Monad<C,​M>> Kleisli<A,​C,​M,​MC> andThen​(Kleisli<B,​C,​M,​MC> after)
        Left-to-right composition of two compatible Kleisli arrows, yielding a new Kleisli arrow.
        Type Parameters:
        C - the new return parameter type
        MC - the Monad instance to return
        Parameters:
        after - the arrow to execute after this one
        Returns:
        the composition of the two arrows as a new Kleisli arrow
      • compose

        default <Z,​MA extends Monad<A,​M>> Kleisli<Z,​B,​M,​MB> compose​(Kleisli<Z,​A,​M,​MA> before)
        Right-to-left composition of two compatible Kleisli arrows, yielding a new Kleisli arrow.
        Type Parameters:
        Z - the new input argument type
        MA - the Monad instance to flatMap with this arrow
        Parameters:
        before - the arrow to execute before this one
        Returns:
        the composition of the two arrows as a new Kleisli arrow
      • discardR

        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. This is generally useful for sequentially performing side-effects.
        Specified by:
        discardR in interface Applicative<A,​B>
        Specified by:
        discardR in interface Fn1<A,​B>
        Specified by:
        discardR in interface Monad<A,​B>
        Specified by:
        discardR in interface MonadReader<A,​B,​M extends Monad<?,​M>>
        Specified by:
        discardR in interface MonadRec<A,​B>
        Specified by:
        discardR in interface MonadWriter<A,​B,​M extends Monad<?,​M>>
        Type Parameters:
        C - the type of appB's parameter
        Parameters:
        appB - the other Applicative
        Returns:
        this Applicative
      • 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 interface Cartesian<A,​B,​M extends Monad<?,​M>>
        Specified by:
        diMapL in interface Cocartesian<A,​B,​M extends Monad<?,​M>>
        Specified by:
        diMapL in interface Fn1<A,​B>
        Specified by:
        diMapL in interface Profunctor<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

        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 a Kleisli arrow.
        Type Parameters:
        A - the input argument type
        B - the output parameter type
        M - the Monad unification parameter
        MB - the returned Monad instance
        Parameters:
        fn - the function
        Returns:
        the function adapted as a Kleisli arrow