com.jnape.palatable.lambda.functions.specialized

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

- Type Parameters:
    `A` - the input argument type
    `M` - the `Monad` unification parameter
    `MB` - the output `Monad` 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 a `Monad`, manifest as simply an ``Fn1`<A, MB>`. This can be thought of as a fixed, portable `Monad.flatMap(Fn1)`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `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.
    `default <Z> Kleisli<Z,B,M,MB>` | `contraMap(Fn1<? super Z,? extends A> fn)` Contravariantly map `A <- 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 this `Applicative` and `appB`, discarding `appB's` result and returning this `Applicative`.
    `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.

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1

      `andThen, apply, carry, cartesian, censor, checkedApply, choose, cocartesian, compose, diMap, diMapR, discardL, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, widen, zip, zip`

    - ### Methods inherited from interface com.jnape.palatable.lambda.monad.Monad

      `join`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

      `coerce`

- - ### 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<MB extends Monad<B,M>,Fn1<A,?>>`
      Specified by:
        `discardR` in interface `Fn1<A,MB extends Monad<B,M>>`
      Specified by:
        `discardR` in interface `Monad<MB extends Monad<B,M>,Fn1<A,?>>`
      Specified by:
        `discardR` in interface `MonadReader<A,MB extends Monad<B,M>,Fn1<A,?>>`
      Specified by:
        `discardR` in interface `MonadRec<MB extends Monad<B,M>,Fn1<A,?>>`
      Specified by:
        `discardR` in interface `MonadWriter<A,MB extends Monad<B,M>,Fn1<A,?>>`
      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 map `A <- B`.
      Specified by:
        `contraMap` in interface `Cartesian<A,MB extends Monad<B,M>,Fn1<?,?>>`
      Specified by:
        `contraMap` in interface `Cocartesian<A,MB extends Monad<B,M>,Fn1<?,?>>`
      Specified by:
        `contraMap` in interface `Contravariant<A,Profunctor<?,MB extends Monad<B,M>,Fn1<?,?>>>`
      Specified by:
        `contraMap` in interface `Fn1<A,MB extends Monad<B,M>>`
      Specified by:
        `contraMap` in interface `Profunctor<A,MB extends Monad<B,M>,Fn1<?,?>>`
      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 interface `Cartesian<A,MB extends Monad<B,M>,Fn1<?,?>>`
      Specified by:
        `diMapL` in interface `Cocartesian<A,MB extends Monad<B,M>,Fn1<?,?>>`
      Specified by:
        `diMapL` in interface `Fn1<A,MB extends Monad<B,M>>`
      Specified by:
        `diMapL` in interface `Profunctor<A,MB extends Monad<B,M>,Fn1<?,?>>`
      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