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

Function scoped

packages/effect/src/Micro.ts:3427–3431  ·  view source on GitHub ↗
(self: Micro<A, E, R>)

Source from the content-addressed store, hash-verified

3425 * @category resources & finalization
3426 */
3427export const scoped = <A, E, R>(self: Micro<A, E, R>): Micro<A, E, Exclude<R, MicroScope>> =>
3428 suspend(() => {
3429 const scope = new MicroScopeImpl()
3430 return onExit(provideService(self, MicroScope, scope), (exit) => scope.close(exit))
3431 })
3432
3433/**
3434 * Create a resource with a cleanup `Micro` effect, ensuring the cleanup is

Callers

nothing calls this directly

Calls 3

closeMethod · 0.95
suspendFunction · 0.70
onExitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…