arrow-fx / arrow.fx.extensions.io.bracket / arrow.Kind / bracket

bracket

@JvmName("bracket") fun <A, B> Kind<ForIO, A>.~~bracket~~(release: (A) -> Kind<ForIO, Unit>, use: (A) -> Kind<ForIO, B>): IO<B> Deprecated: The IO datatype and it’s related type classes will disappear in Arrow 0.13.0. All useful operations are offered directly over suspend functions by Arrow Fx Coroutines. https://arrow-kt.io/docs/fx/async/

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
<