MCPcopy Index your code
hub / github.com/Effect-TS/effect / acquireRelease

Function acquireRelease

packages/effect/src/Micro.ts:3441–3448  ·  view source on GitHub ↗
(
  acquire: Micro<A, E, R>,
  release: (a: A, exit: MicroExit<unknown, unknown>) => Micro<void>
)

Source from the content-addressed store, hash-verified

3439 * @category resources & finalization
3440 */
3441export const acquireRelease = <A, E, R>(
3442 acquire: Micro<A, E, R>,
3443 release: (a: A, exit: MicroExit<unknown, unknown>) => Micro<void>
3444): Micro<A, E, R | MicroScope> =>
3445 uninterruptible(flatMap(
3446 scope,
3447 (scope) => tap(acquire, (a) => scope.addFinalizer((exit) => release(a, exit)))
3448 ))
3449
3450/**
3451 * Add a finalizer to the current `MicroScope`.

Callers

nothing calls this directly

Calls 4

tapFunction · 0.85
uninterruptibleFunction · 0.70
addFinalizerMethod · 0.65
releaseFunction · 0.50

Tested by

no test coverage detected