arrow-fx / arrow.fx.extensions.io.bracket / arrow.Kind

Extensions for arrow.Kind

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.fun <A, B> Kind<ForIO, A>.~~bracket~~(release: (A) -> Kind<ForIO, Unit>, use: (A) -> Kind<ForIO, 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.fun <A, B> Kind<ForIO, A>.~~bracketCase~~(release: (A, ExitCase<Throwable>) -> Kind<ForIO, Unit>, use: (A) -> Kind<ForIO, B>): IO<B>
guarantee Executes the given finalizer when the source is finished, either in success or in error, or if cancelled.fun <A> Kind<ForIO, A>.~~guarantee~~(finalizer: Kind<ForIO, 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.fun <A> Kind<ForIO, A>.~~guaranteeCase~~(finalizer: (ExitCase<Throwable>) -> Kind<ForIO, Unit>): IO<A>
onCancel Executes the given finalizer when the source is cancelled, allowing registering a cancellation token.fun <A> Kind<ForIO, A>.~~onCancel~~(finalizer: Kind<ForIO, Unit>): IO<A>
onError Executes the given finalizer with the given error when the source is finished in error.fun <A> Kind<ForIO, A>.~~onError~~(finalizer: (Throwable) -> Kind<ForIO, Unit>): IO<A>
uncancelable fun <A> Kind<ForIO, A>.~~uncancelable~~(): IO<A>
uncancellable Meant for ensuring a given task continues execution even when interrupted.fun <A> Kind<ForIO, A>.~~uncancellable~~(): IO<A>

Do you like Arrow?

Arrow Org
<