/** * Creates a sink that effectfully folds elements of type `In` into a * structure of type `S`, until `max` worth of elements (determined by the * `costFn`) have been folded. * * @note Elements that have an individual cost larger than `max` will force the * sink to cross the `max` cost. See `foldWeightedDecomposeEffect` for a variant * that can handle these cases. * * @tsplus static effect/core/stream/Sink.Ops foldWeightedEffect */ export function foldWeightedEffect( z: S, costFn: (s: S, input: In) => Effect, max: number, f: (s: S, input: In) => Effect ): Sink { return Sink.foldWeightedDecomposeEffect( z, costFn, max, (i) => Effect.succeed(Chunk.single(i)), f ) }