Hyperlinkv0.8.0-beta.28

Stream

Stream.foreverconsteffect/Stream.ts:2978
<A, E, R>(self: Stream<A, E, R>): Stream<A, E, R>

Repeats this stream forever.

Example (Repeating a stream forever)

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

const stream = Stream.make("A", "B").pipe(
  Stream.forever,
  Stream.take(5)
)

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

Effect.runPromise(program)
// Output: [ "A", "B", "A", "B", "A" ]
sequencing
Source effect/Stream.ts:29781 lines
export const forever = <A, E, R>(self: Stream<A, E, R>): Stream<A, E, R> => fromChannel(Channel.forever(self.channel))