MCPcopy Create free account
hub / github.com/effect-app/libs / runtimePromise

Function runtimePromise

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

Source from the content-addressed store, hash-verified

599 *
600 * ```ts import.meta.vitest
601 * import { Effect, FiberSet } from "effect"
602 *
603 * const program = Effect.gen(function*() {
604 * const set = yield* FiberSet.make()
605 * const runPromise = yield* FiberSet.runtimePromise(set)()
606 *
607 * // Run effects as promises
608 * const promise1 = runPromise(Effect.succeed("hello"))
609 * const promise2 = runPromise(Effect.succeed("world"))
610 *
611 * return [yield* Effect.promise(() => promise1), yield* Effect.promise(() => promise2)]
612 * })
613 *
614 * const actual = await Effect.runPromise(Effect.scoped(program))
615 * actual // => ["hello", "world"]
616 * ```
617 *
618 * @see {@link runtime} for a runner that returns the forked `Fiber`
619 *
620 * @category combinators
621 * @since 3.13.0
622 */
623export const runtimePromise = <A, E>(self: FiberSet<A, E>): <R = never>() => Effect.Effect<
624 <XE extends E, XA extends A>(
625 effect: Effect.Effect<XA, XE, R>,
626 options?:
627 | Effect.RunOptions & { readonly propagateInterruption?: boolean | undefined }
628 | undefined
629 ) => Promise<XA>,
630 never,
631 R
632> =>
633<R>() =>

Callers 1

makeRuntimePromiseFunction · 0.70

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…