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: