arrow-fx / arrow.fx.typeclasses / Bracket / bracket

bracket

open fun <A, B> Kind<F, A>.bracket(release: (A) -> Kind<F, Unit>, use: (A) -> Kind<F, B>): Kind<F, 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
<