arrow-fx / arrow.fx.typeclasses / Bracket / onCancel

onCancel

open fun <A> Kind<F, A>.onCancel(finalizer: Kind<F, Unit>): Kind<F, A>

Executes the given finalizer when the source is cancelled, allowing registering a cancellation token.

Useful for wiring cancellation tokens between fibers, building inter-op with other effect systems or testing.

Do you like Arrow?

Arrow Org
<