arrow-fx / arrow.fx.extensions / IOBracket / bracketCase
open fun <A, B>
IOOf
<A>.bracketCase(release: (A,
ExitCase
<
Throwable
>) ->
IOOf
<
Unit
>, use: (A) ->
IOOf
<B>):
IO
<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?
✖