| 8292 | } |
| 8293 | } |
| 8294 | const zip = ( |
| 8295 | leftChunk: Chunk.Chunk<A>, |
| 8296 | rightChunk: Chunk.Chunk<A2>, |
| 8297 | f: (a: A, a2: A2) => A3 |
| 8298 | ): readonly [Chunk.Chunk<A3>, ZipAllState.ZipAllState<A, A2>] => { |
| 8299 | const [output, either] = zipChunks(leftChunk, rightChunk, f) |
| 8300 | switch (either._tag) { |
| 8301 | case "Left": { |
| 8302 | if (Chunk.isEmpty(either.left)) { |
| 8303 | return [output, ZipAllState.PullBoth] as const |
| 8304 | } |
| 8305 | return [output, ZipAllState.PullRight(either.left)] as const |
| 8306 | } |
| 8307 | case "Right": { |
| 8308 | if (Chunk.isEmpty(either.right)) { |
| 8309 | return [output, ZipAllState.PullBoth] as const |
| 8310 | } |
| 8311 | return [output, ZipAllState.PullLeft(either.right)] as const |
| 8312 | } |
| 8313 | } |
| 8314 | } |
| 8315 | return combineChunks(self, options.other, ZipAllState.PullBoth, pull) |
| 8316 | } |
| 8317 | ) |