XO0203: success of a Result typed T must be written Ok(x)
In a function declared -> T ! E, a returned T means success and a returned Result[T, E] is passed through as is. When T is itself a Result, a returned Result would be ambiguous, so success must be written Ok(x) explicitly. The same applies to closures whose results are collected, as in xs.map(fn(x) { Ok(g()) }). See core 2.6.
Example
enum E { A }
fn f(r: Result[Int, Str]) -> Result[Int, Str] ! E { r }Fix
enum E { A }
fn f(r: Result[Int, Str]) -> Result[Int, Str] ! E { Ok(r) }Run xo explain XO0203 for this text in a terminal, or see
section 10.6 of the specification.