Taking your questions in reverse!
- For the name, I agree that
partitionMapis a better match with the behavior of other algorithms. "split" is in a family (with "chunked" and "windows") of methods that divide a collection into subsequences but otherwise maintain their order, with split dropping the separator element(s). This new method is a partition with an added map step baked in for ergonomic reasons.
- The
Comparableconformance is there so thatEithercan be used as an index for theEitherSequencetype. Rather than designing a properEitheraddition to the Algorithms package (it should also beHashable,Sendable, etc… should it conform toError?), we can just add a single-purpose enum for this, named something likePartitionMapResultwith afirstandsecondcase that will map to the position in the resulting tuple. I think that would be a better strategy for this limited purpose.
- A PR would be welcome!