// ets_tracing: off import * as T from "../../../../Effect/index.js" import * as O from "../../../../Option/index.js" import type * as C from "../core.js" import * as LoopOnPartialChunksElements from "./loopOnPartialChunksElements.js" /** * Performs an effectful filter and map in a single step. */ export function collectEffect_( self: C.Stream, pf: (a: A) => O.Option> ): C.Stream { return LoopOnPartialChunksElements.loopOnPartialChunksElements_(self, (a, emit) => O.fold_( pf(a), () => T.unit, (_) => T.asUnit(T.chain_(_, emit)) ) ) } /** * Performs an effectful filter and map in a single step. * * @ets_data_first collectEffect_ */ export function collectEffect( pf: (a: A) => O.Option> ) { return (self: C.Stream) => collectEffect_(self, pf) }