Class AutoBracket<A extends AutoCloseable, B>
java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn2.AutoBracket<A,B>
- Type Parameters:
A- the initialAutoCloseablevalue type to map and clean upB- 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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends AutoCloseable, B>
AutoBracket<A, B> 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) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
AutoBracket
private AutoBracket()
-
-
Method Details
-
checkedApply
-
autoBracket
-
autoBracket
-
autoBracket
public static <A extends AutoCloseable, B> IO<B> autoBracket(IO<A> io, Fn1<? super A, ? extends IO<B>> bodyIO)
-