Hyperlinkv0.8.0-beta.28

Stream

Stream.fromPullconsteffect/Stream.ts:614
<A, E, R, EX, RX>(
  pull: Effect.Effect<
    Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R>,
    EX,
    RX
  >
): Stream<A, Pull.ExcludeDone<E> | EX, R | RX>

Creates a stream from a pull effect, such as one produced by Stream.toPull.

Details

A pull effect yields chunks on demand and completes when the upstream stream ends. See Stream.toPull for a matching producer.

Example (Creating a stream from a pull effect)

import { Console, Effect, Stream } from "effect"

const program = Effect.scoped(
  Effect.gen(function*() {
    const source = Stream.make(1, 2, 3)
    const pull = yield* Stream.toPull(source)
    const stream = Stream.fromPull(Effect.succeed(pull))
    const values = yield* Stream.runCollect(stream)
    yield* Console.log(values)
  })
)

Effect.runPromise(program)
// Output: [1, 2, 3]
constructors
Source effect/Stream.ts:6143 lines
export const fromPull = <A, E, R, EX, RX>(
  pull: Effect.Effect<Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R>, EX, RX>
): Stream<A, Pull.ExcludeDone<E> | EX, R | RX> => fromChannel(Channel.fromPull(pull))
Referenced by 10 symbols