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

Function make

packages/effect/src/FiberMap.ts:120–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118 * @categories constructors
119 */
120export const make = <K, A = unknown, E = unknown>(): Effect.Effect<FiberMap<K, A, E>, never, Scope.Scope> =>
121 Effect.acquireRelease(
122 Effect.map(Deferred.make<void, E>(), (deferred) =>
123 unsafeMake<K, A, E>(
124 MutableHashMap.empty(),
125 deferred
126 )),
127 (map) =>
128 Effect.withFiberRuntime((parent) => {
129 const state = map.state
130 if (state._tag === "Closed") return Effect.void
131 map.state = { _tag: "Closed" }
132 return Fiber.interruptAllAs(
133 Iterable.map(state.backing, ([, fiber]) => fiber),
134 FiberId.combine(parent.id(), internalFiberId)
135 ).pipe(
136 Effect.intoDeferred(map.deferred)
137 )
138 })
139 )
140
141/**
142 * Create an Effect run function that is backed by a FiberMap.

Callers 2

makeRuntimeFunction · 0.70
makeRuntimePromiseFunction · 0.70

Calls 6

unsafeMakeFunction · 0.70
mapMethod · 0.65
makeMethod · 0.65
pipeMethod · 0.65
combineMethod · 0.65
idMethod · 0.65

Tested by

no test coverage detected