arrow-fx / arrow.fx.typeclasses / Bracket / bracketCase
abstract fun <A, B> Kind<F, A>.bracketCase(release: (A,
ExitCase
<E>) -> Kind<F,
Unit
>, use: (A) -> Kind<F, B>): Kind<F, B>
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.
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?
✖