Hyperlinkv0.8.0-beta.28

Stream

Stream<{}, never, never>

Provides the entry point for do-notation style stream composition.

Example (Starting stream do notation)

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

const program = pipe(
  Stream.Do,
  Stream.bind("value", () => Stream.fromArray([1, 2])),
  Stream.let("next", ({ value }) => value + 1)
)

const effect = Effect.gen(function*() {
  const collected = yield* Stream.runCollect(program)
  yield* Console.log(collected)
})

Effect.runPromise(effect)
//=> [{ value: 1, next: 2 }, { value: 2, next: 3 }]
do notation
export const Do: Stream<{}> = succeed({})