unzip method

(Option<A>, Option<B>) unzip()

Splits a present pair into two present options, and absence into two absent ones.

final (left, right) = const Some<(int, String)>((1, 'a')).unzip();

Implementation

(Option<A>, Option<B>) unzip() {
  return switch (this) {
    Some<(A, B)>(value: (final left, final right)) => (
        Some<A>(left),
        Some<B>(right),
      ),
    None<(A, B)>() => (None<A>(), None<B>()),
  };
}