Hyperlinkv0.8.0-beta.28

Stream

Stream.concatconsteffect/Stream.ts:3059
<A2, E2, R2>(that: Stream<A2, E2, R2>): <A, E, R>(
  self: Stream<A, E, R>
) => Stream<A | A2, E | E2, R | R2>
<A, E, R, A2, E2, R2>(
  self: Stream<A, E, R>,
  that: Stream<A2, E2, R2>
): Stream<A | A2, E | E2, R | R2>

Concatenates two streams, emitting all elements from the first stream followed by all elements from the second stream.

Example (Concatenating streams)

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

const stream = Stream.concat(Stream.make(1, 2, 3), Stream.make(4, 5, 6))

Effect.gen(function*() {
  const values = yield* Stream.runCollect(stream)
  yield* Console.log(values)
})
// Output: [ 1, 2, 3, 4, 5, 6 ]
sequencing
Source effect/Stream.ts:30598 lines
export const concat: {
  <A2, E2, R2>(that: Stream<A2, E2, R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A | A2, E | E2, R | R2>
  <A, E, R, A2, E2, R2>(self: Stream<A, E, R>, that: Stream<A2, E2, R2>): Stream<A | A2, E | E2, R | R2>
} = dual(
  2,
  <A, E, R, A2, E2, R2>(self: Stream<A, E, R>, that: Stream<A2, E2, R2>): Stream<A | A2, E | E2, R | R2> =>
    flatten(fromArray<Stream<A | A2, E | E2, R | R2>>([self, that]))
)
Referenced by 2 symbols