Hyperlinkv0.8.0-beta.28

Stream

Stream.flattenIterableconsteffect/Stream.ts:3001
<A, E, R>(self: Stream<Iterable<A>, E, R>): Stream<A, E, R>

Flattens the iterables emitted by this stream into the stream's structure.

Example (Flattening iterable values)

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

const program = Effect.gen(function*() {
  const stream = Stream.make([1, 2], [3, 4]).pipe(Stream.flattenIterable)
  const values = yield* Stream.runCollect(stream)
  yield* Console.log(values)
})

Effect.runPromise(program)
// Output: [ 1, 2, 3, 4 ]
mapping
Source effect/Stream.ts:30012 lines
export const flattenIterable = <A, E, R>(self: Stream<Iterable<A>, E, R>): Stream<A, E, R> =>
  flatMap(self, fromIterable)