ok method

Option<T> ok()

The successful value as Some, or None for an Err.

The error is dropped. Use it where failure only means "no value".

final score = const Err<int, String>('offline').ok(); // None()

Implementation

Option<T> ok() {
  return switch (this) {
    Ok<T, E>(:final value) => Some<T>(value),
    Err<T, E>() => None<T>(),
  };
}