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

Function make

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

Source from the content-addressed store, hash-verified

169 * @since 2.0.0
170 */
171export const make = <K, A = unknown, E = unknown>(): Effect.Effect<FiberMap<K, A, E>, never, Scope.Scope> =>
172 Effect.acquireRelease(
173 Effect.sync(() =>
174 makeUnsafe<K, A, E>(
175 MutableHashMap.empty(),
176 Deferred.makeUnsafe()
177 )
178 ),
179 (map) =>
180 Effect.suspend(() => {
181 const state = map.state
182 if (state._tag === "Closed") return Effect.void
183 map.state = { _tag: "Closed" }
184 return Fiber.interruptAll(state.fibers).pipe(
185 Deferred.into(map.deferred)
186 )
187 })
188 )
189
190/**
191 * Creates a scoped run function that forks effects into a new `FiberMap`.

Callers 2

makeRuntimeFunction · 0.70
makeRuntimePromiseFunction · 0.70

Calls 3

makeUnsafeFunction · 0.70
pipeMethod · 0.65
syncMethod · 0.45

Tested by

no test coverage detected