MCPcopy Index your code
hub / github.com/Effect-TS/effect / foldChunksEffectReader

Function foldChunksEffectReader

packages/effect/src/internal/sink.ts:964–981  ·  view source on GitHub ↗
(
  s: S,
  contFn: Predicate<S>,
  f: (s: S, chunk: Chunk.Chunk<In>) => Effect.Effect<S, E, R>
)

Source from the content-addressed store, hash-verified

962
963/** @internal */
964const foldChunksEffectReader = <S, R, E, In>(
965 s: S,
966 contFn: Predicate<S>,
967 f: (s: S, chunk: Chunk.Chunk<In>) => Effect.Effect<S, E, R>
968): Channel.Channel<never, Chunk.Chunk<In>, E, E, S, unknown, R> => {
969 if (!contFn(s)) {
970 return core.succeedNow(s)
971 }
972 return core.readWith({
973 onInput: (input: Chunk.Chunk<In>) =>
974 pipe(
975 core.fromEffect(f(s, input)),
976 core.flatMap((s) => foldChunksEffectReader(s, contFn, f))
977 ),
978 onFailure: core.fail,
979 onDone: () => core.succeedNow(s)
980 })
981}
982
983/** @internal */
984export const foldEffect = <S, In, E, R>(

Callers 1

foldChunksEffectFunction · 0.85

Calls 3

fromEffectMethod · 0.80
pipeFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected