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

bracketCase

@JvmName("bracketCase") fun <A, B> Kind<ForIO, A>.~~bracketCase~~(release: (A, ExitCase<Throwable>) -> Kind<ForIO, Unit>, use: (A) -> Kind<ForIO, B>): IO<B> 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/

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.

Parameters

use - is the action to consume the resource and produce an F with the result. Once the resulting F terminates, either successfully, error or cancelled.

release - the allocated resource after the resulting F of use is terminates.

Do you like Arrow?

Arrow Org
<