MCPcopy Create free account
hub / github.com/Effect-TS/effect / scoped

Function scoped

packages/effect/src/internal/channel.ts:2070–2084  ·  view source on GitHub ↗
(
  effect: Effect.Effect<A, E, R>
)

Source from the content-addressed store, hash-verified

2068
2069/** @internal */
2070export const scoped = <A, E, R>(
2071 effect: Effect.Effect<A, E, R>
2072): Channel.Channel<A, unknown, E, unknown, unknown, unknown, Exclude<R, Scope.Scope>> =>
2073 unwrap(
2074 Effect.uninterruptibleMask((restore) =>
2075 Effect.map(Scope.make(), (scope) =>
2076 core.acquireReleaseOut(
2077 Effect.tapErrorCause(
2078 restore(Scope.extend(effect, scope)),
2079 (cause) => Scope.close(scope, Exit.failCause(cause))
2080 ),
2081 (_, exit) => Scope.close(scope, exit)
2082 ))
2083 )
2084 )
2085
2086/** @internal */
2087export const scopedWith = <A, E, R>(

Callers 1

unwrapScopedFunction · 0.70

Calls 6

restoreFunction · 0.85
failCauseMethod · 0.80
unwrapFunction · 0.70
mapMethod · 0.65
makeMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…