( s: S, chunk: Chunk.Chunk<In>, index: number, length: number, contFn: Predicate<S>, f: (s: S, input: In) => Effect.Effect<S, E, R> )
| 1026 | |
| 1027 | /** @internal */ |
| 1028 | const foldChunkSplitEffectInternal = <S, R, E, In>( |
| 1029 | s: S, |
| 1030 | chunk: Chunk.Chunk<In>, |
| 1031 | index: number, |
| 1032 | length: number, |
| 1033 | contFn: Predicate<S>, |
| 1034 | f: (s: S, input: In) => Effect.Effect<S, E, R> |
| 1035 | ): Effect.Effect<[S, Option.Option<Chunk.Chunk<In>>], E, R> => { |
| 1036 | if (index === length) { |
| 1037 | return Effect.succeed([s, Option.none()]) |
| 1038 | } |
| 1039 | return pipe( |
| 1040 | f(s, pipe(chunk, Chunk.unsafeGet(index))), |
| 1041 | Effect.flatMap((s1) => |
| 1042 | contFn(s1) ? |
| 1043 | foldChunkSplitEffectInternal(s1, chunk, index + 1, length, contFn, f) : |
| 1044 | Effect.succeed([s1, Option.some(pipe(chunk, Chunk.drop(index + 1)))]) |
| 1045 | ) |
| 1046 | ) |
| 1047 | } |
| 1048 | |
| 1049 | /** @internal */ |
| 1050 | export const foldLeft = <S, In>(s: S, f: (s: S, input: In) => S): Sink.Sink<S, In> => |
no test coverage detected