Package: effect
Module: Stream
Applies a sink transducer to the stream and emits each sink result.
Example (Transducing with a sink)
import { Console, Effect, Sink, Stream } from "effect"
const program = Effect.gen(function* () {
const result = yield* Stream.make(1, 2, 3, 4).pipe(
Stream.transduce(Sink.take(2)),
Stream.runCollect
)
yield* Console.log(result)
// Output: [ [ 1, 2 ], [ 3, 4 ] ]
})
Signature
declare const transduce: (<A2, A, E2, R2>(sink: Sink.Sink<A2, A, A, E2, R2>) => <E, R>(self: Stream<A, E, R>) => Stream<A2, E2 | E, R2 | R>) & (<A, E, R, A2, E2, R2>(self: Stream<A, E, R>, sink: Sink.Sink<A2, A, A, E2, R2>) => Stream<A2, E2 | E, R2 | R>)
Since v2.0.0