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

Function runImpl

packages/effect/src/FiberSet.ts:505–519  ·  view source on GitHub ↗
(
  self: FiberSet<A, E>,
  effect: Effect.Effect<XA, XE, R>,
  options?: {
    readonly propagateInterruption?: boolean | undefined
  }
)

Source from the content-addressed store, hash-verified

503}
504
505const runImpl = <A, E, R, XE extends E, XA extends A>(
506 self: FiberSet<A, E>,
507 effect: Effect.Effect<XA, XE, R>,
508 options?: {
509 readonly propagateInterruption?: boolean | undefined
510 }
511): Effect.Effect<Fiber.Fiber<XA, XE>, never, R> =>
512 Effect.withFiber((parent) => {
513 if (self.state._tag === "Closed") {
514 return Effect.sync(constInterruptedFiber)
515 }
516 const fiber = Effect.runForkWith(parent.context as Context<R>)(effect)
517 addUnsafe(self, fiber, options)
518 return Effect.succeed(fiber)
519 })
520
521/**
522 * Captures a `Runtime` and uses it to fork effects into the `FiberSet`.

Callers 1

runFunction · 0.70

Calls 3

addUnsafeFunction · 0.85
syncMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected