export function partitionMap(
as: Collection,
f: (a: A) => Either
): readonly [Chunk, Chunk] {
return Chunk.from(as).reduceRight(
[Chunk.empty(), Chunk.empty()] as const,
(a, [es, bs]) =>
f(a).fold(
(e) => [es.prepend(e), bs] as const,
(b) => [es, bs.prepend(b)] as const
)
)
}