MCPcopy
hub / github.com/Effect-TS/effect / foldUntilEffect

Function foldUntilEffect

packages/effect/src/internal/sink.ts:1083–1095  ·  view source on GitHub ↗
(
  s: S,
  max: number,
  f: (s: S, input: In) => Effect.Effect<S, E, R>
)

Source from the content-addressed store, hash-verified

1081
1082/** @internal */
1083export const foldUntilEffect = <S, In, E, R>(
1084 s: S,
1085 max: number,
1086 f: (s: S, input: In) => Effect.Effect<S, E, R>
1087): Sink.Sink<S, In, In, E, R> =>
1088 pipe(
1089 foldEffect(
1090 [s, 0 as number] as const,
1091 (tuple) => tuple[1] < max,
1092 ([output, count], input: In) => pipe(f(output, input), Effect.map((s) => [s, count + 1] as const))
1093 ),
1094 map((tuple) => tuple[0])
1095 )
1096
1097/** @internal */
1098export const foldWeighted = <S, In>(

Callers

nothing calls this directly

Calls 5

foldEffectFunction · 0.85
pipeFunction · 0.70
mapMethod · 0.65
fFunction · 0.50
mapFunction · 0.50

Tested by

no test coverage detected