/** * Compact an `Either>` to an `Either` given an * `AssociativeIdentity`. * * @tsplus static Either.Aspects compactMaybe * @tsplus pipeable Either compactMaybe */ export function compactMaybe(M: AssociativeIdentity) { return (self: Either>): Either => self.isLeft() ? self : self.right._tag === "None" ? Either.left(M.identity) : Either.right(self.right.value) }