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

Function runtime

packages/effect/src/FiberMap.ts:923–948  ·  view source on GitHub ↗
(self: FiberMap<K, A, E>)

Source from the content-addressed store, hash-verified

921 never,
922 R
923> = <K, A, E>(self: FiberMap<K, A, E>) => <R>() =>
924 Effect.map(
925 Effect.context<R>(),
926 (services) => {
927 const runFork = Effect.runForkWith(services)
928 return <XE extends E, XA extends A>(
929 key: K,
930 effect: Effect.Effect<XA, XE, R>,
931 options?:
932 | Effect.RunOptions & {
933 readonly onlyIfMissing?: boolean | undefined
934 readonly propagateInterruption?: boolean | undefined
935 }
936 | undefined
937 ) => {
938 if (self.state._tag === "Closed") {
939 return constInterruptedFiber()
940 } else if (options?.onlyIfMissing === true && hasUnsafe(self, key)) {
941 return constInterruptedFiber()
942 }
943 const fiber = runFork(effect, options)
944 setUnsafe(self, key, fiber, options)
945 return fiber
946 }
947 }
948 )
949
950/**
951 * 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