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

Function runtimePromise

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

Source from the content-addressed store, hash-verified

473 * @categories combinators
474 */
475export const runtimePromise = <A, E>(self: FiberHandle<A, E>): <R = never>() => Effect.Effect<
476 <XE extends E, XA extends A>(
477 effect: Effect.Effect<XA, XE, R>,
478 options?:
479 | Runtime.RunForkOptions & { readonly propagateInterruption?: boolean | undefined }
480 | undefined
481 ) => Promise<XA>,
482 never,
483 R
484> =>
485<R>() =>
486 Effect.map(
487 runtime(self)<R>(),
488 (runFork) =>
489 <XE extends E, XA extends A>(
490 effect: Effect.Effect<XA, XE, R>,
491 options?:
492 | Runtime.RunForkOptions & { readonly propagateInterruption?: boolean | undefined }
493 | undefined
494 ): Promise<XA> =>
495 new Promise((resolve, reject) =>
496 runFork(effect, options).addObserver((exit) => {
497 if (Exit.isSuccess(exit)) {
498 resolve(exit.value)
499 } else {
500 reject(Cause.squash(exit.cause))
501 }
502 })
503 )
504 )
505
506/**
507 * If any of the Fiber's in the handle terminate with a failure,

Callers 1

makeRuntimePromiseFunction · 0.70

Calls 5

resolveFunction · 0.85
runtimeFunction · 0.70
runForkFunction · 0.70
mapMethod · 0.65
addObserverMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…