Class Bracket<A,B>
- java.lang.Object
-
- com.jnape.palatable.lambda.functions.builtin.fn3.Bracket<A,B>
-
- Type Parameters:
A
- the initial value to map and clean upB
- the resulting type
- All Implemented Interfaces:
Fn1<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>>
,Fn2<IO<A>,Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>
,Fn3<IO<A>,Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>>
,Applicative<Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
,Cartesian<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<?,?>>
,Cocartesian<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<?,?>>
,Contravariant<IO<A>,Profunctor<?,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<?,?>>>
,Functor<Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
,Profunctor<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<?,?>>
,Monad<Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
,MonadReader<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
,MonadRec<Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
,MonadWriter<IO<A>,Fn1<Fn1<? super A,? extends IO<?>>,Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>>,Fn1<IO<A>,?>>
public final class Bracket<A,B> extends java.lang.Object implements Fn3<IO<A>,Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>>
Given anIO
that yields some typeA
, a cleanup operation to run if a value of that type could be provisioned, and a kleisli arrow from that type to a newIO
of typeB
, produce an
that, when run, will provision theIO
<B>A
,flatMap
it toB
, and clean up the original value if it was produced in the first place.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Bracket()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A,B>
Bracket<A,B>bracket()
static <A,B>
Fn2<Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>>bracket(IO<A> io)
static <A,B>
Fn1<Fn1<? super A,? extends IO<B>>,IO<B>>bracket(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO)
static <A,B>
IO<B>bracket(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO, Fn1<? super A,? extends IO<B>> bodyIO)
IO<B>
checkedApply(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO, 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
-
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn2
checkedApply, toBiFunction
-
-
-
-
Field Detail
-
INSTANCE
private static final Bracket<?,?> INSTANCE
-
-
Method Detail
-
checkedApply
public IO<B> checkedApply(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO, Fn1<? super A,? extends IO<B>> bodyIO) throws java.lang.Throwable
-
bracket
public static <A,B> Bracket<A,B> bracket()
-
bracket
public static <A,B> Fn2<Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>> bracket(IO<A> io)
-
bracket
public static <A,B> Fn1<Fn1<? super A,? extends IO<B>>,IO<B>> bracket(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO)
-
-