/** * Statefully and effectfully maps over the elements of this stream to produce * all intermediate results. * * @tsplus static effect/core/stream/Stream.Aspects scanReduceEffect * @tsplus pipeable effect/core/stream/Stream scanReduceEffect */ export function scanReduceEffect( f: (a2: A2, a: A) => Effect ) { return (self: Stream): Stream => self.mapAccumEffect( Maybe.empty(), (option: Maybe, a) => option.fold( Effect.succeed([Maybe.some(a as A2), a as A2] as const), (a2) => f(a2, a).map((a2) => [Maybe.some(a2), a2]) ) ) }