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

Function runtimePromise

packages/effect/src/FiberSet.ts:420–449  ·  view source on GitHub ↗
(self: FiberSet<A, E>)

Source from the content-addressed store, hash-verified

418 * @categories combinators
419 */
420export const runtimePromise = <A, E>(self: FiberSet<A, E>): <R = never>() => Effect.Effect<
421 <XE extends E, XA extends A>(
422 effect: Effect.Effect<XA, XE, R>,
423 options?:
424 | Runtime.RunForkOptions & { readonly propagateInterruption?: boolean | undefined }
425 | undefined
426 ) => Promise<XA>,
427 never,
428 R
429> =>
430<R>() =>
431 Effect.map(
432 runtime(self)<R>(),
433 (runFork) =>
434 <XE extends E, XA extends A>(
435 effect: Effect.Effect<XA, XE, R>,
436 options?:
437 | Runtime.RunForkOptions & { readonly propagateInterruption?: boolean | undefined }
438 | undefined
439 ): Promise<XA> =>
440 new Promise((resolve, reject) =>
441 runFork(effect, options).addObserver((exit) => {
442 if (Exit.isSuccess(exit)) {
443 resolve(exit.value)
444 } else {
445 reject(Cause.squash(exit.cause))
446 }
447 })
448 )
449 )
450
451/**
452 * @since 2.0.0

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…