arrow-fx / arrow.fx.extensions / IOBracket

IOBracket

interface ~~IOBracket~~ : Bracket<ForIO, Throwable>, IOMonadThrow Deprecated: The IO datatype and it’s related type classes will disappear in Arrow 0.13.0. All useful operations are offered directly over suspend functions by Arrow Fx Coroutines. https://arrow-kt.io/docs/fx/async/

Functions

bracket Meant for specifying tasks with safe resource acquisition and release in the face of errors and interruption. It would be the the equivalent of try/catch/finally statements in mainstream imperative languages for resource acquisition and release.open fun <A, B> IOOf<A>.bracket(release: (A) -> IOOf<Unit>, use: (A) -> IOOf<B>): IO<B>
bracketCase A way to safely acquire a resource and release in the face of errors and cancellation. It uses ExitCase to distinguish between different exit cases when releasing the acquired resource.open fun <A, B> IOOf<A>.bracketCase(release: (A, ExitCase<Throwable>) -> IOOf<Unit>, use: (A) -> IOOf<B>): IO<B>
guarantee Executes the given finalizer when the source is finished, either in success or in error, or if cancelled.open fun <A> IOOf<A>.guarantee(finalizer: IOOf<Unit>): IO<A>
guaranteeCase Executes the given finalizer when the source is finished, either in success or in error, or if cancelled, allowing for differentiating between exit conditions. That’s thanks to the ExitCase argument of the finalizer.open fun <A> IOOf<A>.guaranteeCase(finalizer: (ExitCase<Throwable>) -> IOOf<Unit>): IO<A>

Inheritors

IOMonadDefer interface ~~IOMonadDefer~~ : MonadDefer<ForIO>, IOBracket

Do you like Arrow?

Arrow Org
<