java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn3.Bracket<A,B>
Type Parameters:
A - the initial value to map and clean up
B - 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 Object implements Fn3<IO<A>,Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>>
Given an IO that yields some type A, a cleanup operation to run if a value of that type could be provisioned, and a kleisli arrow from that type to a new IO of type B, produce an IO<B> that, when run, will provision the A, flatMap it to B, and clean up the original value if it was produced in the first place.
  • Field Details

    • INSTANCE

      private static final Bracket<?,?> INSTANCE
  • Constructor Details

    • Bracket

      private Bracket()
  • Method Details

    • checkedApply

      public IO<B> checkedApply(IO<A> io, Fn1<? super A,? extends IO<?>> cleanupIO, Fn1<? super A,? extends IO<B>> bodyIO) throws Throwable
      Specified by:
      checkedApply in interface Fn3<IO<A>,Fn1<? super A,? extends IO<?>>,Fn1<? super A,? extends IO<B>>,IO<B>>
      Throws:
      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)
    • bracket

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