Hyperlinkv0.8.0-beta.28

Channel

Channel.toPullScopedconsteffect/Channel.ts:8102
<OutElem, OutErr, OutDone, Env>(
  self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>,
  scope: Scope.Scope
): Effect.Effect<Pull.Pull<OutElem, OutErr, OutDone, Env>, never, Env>

Converts a channel to a Pull within an existing scope.

Example (Converting channels to scoped pulls)

import { Channel, Data, Effect, Scope } from "effect"

class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
  readonly reason: string
}> {}

// Create a channel
const numbersChannel = Channel.fromIterable([1, 2, 3])

// Convert to Pull with explicit scope
const scopedPullEffect = Effect.gen(function*() {
  const scope = yield* Scope.make()
  const pull = yield* Channel.toPullScoped(numbersChannel, scope)
  return pull
})
destructors
export const toPullScoped = <OutElem, OutErr, OutDone, Env>(
  self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>,
  scope: Scope.Scope
): Effect.Effect<Pull.Pull<OutElem, OutErr, OutDone, Env>, never, Env> => toTransform(self)(Cause.done(), scope)
Referenced by 8 symbols