arrow-fx / arrow.fx.extensions / IOBracket / bracket

bracket

open fun <A, B> IOOf<A>.bracket(release: (A) -> IOOf<Unit>, use: (A) -> IOOf<B>): IO<B>

Meant for specifying tasks with safe resource acquisition and release in the face of errors and interruption. It would be the the equivalent of try/catch/finally statements in mainstream imperative languages for resource acquisition and release.

Parameters

release - is the action that’s supposed to release the allocated resource after use is done, irregardless of its exit condition.

Do you like Arrow?

Arrow Org
<