com.jnape.palatable.lambda.functions.builtin.fn2

## Class AutoBracket<A extends AutoCloseable,B>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn2.AutoBracket<A,B>

- Type Parameters:
    `A` - the initial `AutoCloseable` value type to map and clean up
    `B` - the resulting type
  All Implemented Interfaces:
    Fn1<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>, Fn2<IO<A>,Fn1<? super A,? extends IO<B>>,IO<B>>, Applicative<Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>, Cartesian<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<?,?>>, Cocartesian<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<?,?>>, Contravariant<IO<A>,Profunctor<?,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<?,?>>>, Functor<Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>, Profunctor<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<?,?>>, Monad<Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>, MonadReader<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>, MonadRec<Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>, MonadWriter<IO<A>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>,Fn1<IO<A>,?>>

      public final class AutoBracket<A extends AutoCloseable,B>
      extends Object
      implements Fn2<IO<A>,Fn1<? super A,? extends IO<B>>,IO<B>>

  Given an `IO` yielding some `AutoCloseable` type `A` and a kleisli arrow from that type to a new `IO` of type `B`, attempt to provision the `A`, applying the body operation if provisioning was successful and ensuring that `AutoCloseable.close()` is called regardless of whether the body succeeds or fails.

  This is the canonical `bracketing` operation for `AutoCloseables`.

  See Also:
    `Bracket`

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <A extends AutoCloseable,B> AutoBracket<A,B>` | `autoBracket()`
    `static <A extends AutoCloseable,B> Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>` | `autoBracket(IO<A> io)`
    `static <A extends AutoCloseable,B> IO<B>` | `autoBracket(IO<A> io, Fn1<? super A,? extends IO<B>> bodyIO)`
    `IO<B>` | `checkedApply(IO<A> io, Fn1<? super A,? extends IO<B>> bodyIO)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

      `apply, apply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, flip, fn2, fromBiFunction, toBiFunction, uncurry, widen`

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

      `andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, 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

    - #### checkedApply

          public IO<B> checkedApply(IO<A> io,
                                    Fn1<? super A,? extends IO<B>> bodyIO)

      Specified by:
        `checkedApply` in interface `Fn2<IO<A extends AutoCloseable>,Fn1<? super A extends AutoCloseable,? extends IO<B>>,IO<B>>`

    - #### autoBracket

          public static <A extends AutoCloseable,B> AutoBracket<A,B> autoBracket()

    - #### autoBracket

          public static <A extends AutoCloseable,B> Fn1<Fn1<? super A,? extends IO<B>>,IO<B>> autoBracket(IO<A> io)

    - #### autoBracket

          public static <A extends AutoCloseable,B> IO<B> autoBracket(IO<A> io,
                                                                      Fn1<? super A,? extends IO<B>> bodyIO)