/** * Separates an `Either>` into a * `Tuple<[Either, Either]>` given an `AssociativeIdentity`. * * @tsplus static Either.Aspects separate * @tsplus pipeable Either separate */ export function separate(M: AssociativeIdentity) { return (self: Either>): readonly [Either, Either] => { const empty = Either.left(M.identity) return self.isLeft() ? [self, self] : self.right.isLeft() ? [Either.right(self.right.left), empty] : [empty, Either.right(self.right.right)] } }