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

Function runtime

packages/effect/src/FiberHandle.ts:686–712  ·  view source on GitHub ↗
(self: FiberHandle<A, E>)

Source from the content-addressed store, hash-verified

684 never,
685 R
686> = <A, E>(self: FiberHandle<A, E>) => <R>() =>
687 Effect.map(
688 Effect.context<R>(),
689 (services) => {
690 const runFork = Effect.runForkWith(services)
691 return <XE extends E, XA extends A>(
692 effect: Effect.Effect<XA, XE, R>,
693 options?:
694 | {
695 readonly signal?: AbortSignal | undefined
696 readonly scheduler?: Scheduler | undefined
697 readonly onlyIfMissing?: boolean | undefined
698 readonly propagateInterruption?: boolean | undefined
699 }
700 | undefined
701 ) => {
702 if (self.state._tag === "Closed") {
703 return constInterruptedFiber()
704 } else if (self.state.fiber !== undefined && options?.onlyIfMissing === true) {
705 return constInterruptedFiber()
706 }
707 const fiber = runFork(effect, options)
708 setUnsafe(self, fiber, options)
709 return fiber
710 }
711 }
712 )
713
714/**
715 * Captures the current runtime and returns a function for running effects in

Callers 2

makeRuntimeFunction · 0.70
runtimePromiseFunction · 0.70

Calls 4

runForkFunction · 0.85
setUnsafeFunction · 0.85
contextMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected