arrow-fx / arrow.fx / IO / guaranteeCase

guaranteeCase

fun guaranteeCase(finalizer: (ExitCase<Throwable>) -> IOOf<Unit>): IO<A>

Executes the given finalizer when the source is finished, either in success or in error, or if canceled, allowing for differentiating between exit conditions. That’s thanks to the ExitCase argument of the finalizer.

As best practice, it’s not a good idea to release resources via guaranteeCase in polymorphic code. Prefer bracketCase for the acquisition and release of resources.

See Also

guarantee

bracketCase

Do you like Arrow?

Arrow Org
<