package simple_math_interpreter.ext public interface OptionExt<T> { func okOr<E>(e: E): Result<T, E> } extend<T> Option<T> <: OptionExt<T> { public func okOr<E>(e: E): Result<T, E> { match (this) { case Some(v) => Ok(v) case None => Err(e) } } }