effect-io-ai

Package: effect
Module: Sink

Sink.foldArray

Folds non-empty input arrays into state with an effectful function.

When to use

Use to update state with an effectful function once per pulled non-empty input array when batch-level processing is the natural unit.

Details

The initial state is evaluated lazily. After each pulled array is folded, the sink continues while contFn returns true; otherwise it completes with the current state.

See

Signature

declare const foldArray: <S, In, E = never, R = never>(s: LazyArg<S>, contFn: Predicate<S>, f: (s: S, input: Arr.NonEmptyReadonlyArray<In>) => Effect.Effect<S, E, R>) => Sink<S, In, never, E, R>

Source

Since v4.0.0