transpose method

Result<Option<S>, F> transpose()

Transposes an Option of a Result into a Result of an Option.

Implementation

Result<Option<S>, F> transpose() {
  if (isSome()) {
    final val = unwrap();
    if (val.isOk()) {
      return Ok(Option._(val.unwrap()));
    } else {
      return Err(val.unwrapErr());
    }
  }
  return Ok(None);
}