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

Function make

packages/effect/src/FiberHandle.ts:146–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144 * @since 2.0.0
145 */
146export const make = <A = unknown, E = unknown>(): Effect.Effect<FiberHandle<A, E>, never, Scope.Scope> =>
147 Effect.acquireRelease(
148 Effect.sync(() => makeUnsafe<A, E>()),
149 (handle) => {
150 const state = handle.state
151 if (state._tag === "Closed") return Effect.void
152 handle.state = { _tag: "Closed" }
153 return state.fiber ?
154 Deferred.into(
155 Effect.asVoid(Fiber.interruptAs(state.fiber, internalFiberId)),
156 handle.deferred
157 ) :
158 Deferred.done(handle.deferred, Exit.void)
159 }
160 )
161
162/**
163 * Creates a scoped run function that forks effects into a new `FiberHandle`.

Callers 2

makeRuntimeFunction · 0.70
makeRuntimePromiseFunction · 0.70

Calls 3

makeUnsafeFunction · 0.70
syncMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected