arrow-fx / arrow.fx.typeclasses / Bracket / guaranteeCase

guaranteeCase

open fun <A> Kind<F, A>.guaranteeCase(finalizer: (ExitCase<E>) -> Kind<F, Unit>): Kind<F, A>

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.

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
<