Class AutoBracket<A extends java.lang.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 java.lang.AutoCloseable,B> extends java.lang.Object implements Fn2<IO<A>,Fn1<? super A,? extends IO<B>>,IO<B>>
Given anIOyielding someAutoCloseabletypeAand a kleisli arrow from that type to a newIOof typeB, attempt to provision theA, applying the body operation if provisioning was successful and ensuring thatAutoCloseable.close()is called regardless of whether the body succeeds or fails.This is the canonical
bracketingoperation forAutoCloseables.- See Also:
Bracket
-
-
Field Summary
Fields Modifier and Type Field Description private static AutoBracket<?,?>INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateAutoBracket()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A extends java.lang.AutoCloseable,B>
AutoBracket<A,B>autoBracket()static <A extends java.lang.AutoCloseable,B>
Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>autoBracket(IO<A> io)static <A extends java.lang.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.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
-
-
-
Field Detail
-
INSTANCE
private static final AutoBracket<?,?> INSTANCE
-
-
Method Detail
-
autoBracket
public static <A extends java.lang.AutoCloseable,B> AutoBracket<A,B> autoBracket()
-
autoBracket
public static <A extends java.lang.AutoCloseable,B> Fn1<Fn1<? super A,? extends IO<B>>,IO<B>> autoBracket(IO<A> io)
-
-