Something went wrong. Try again.
An experiment in static, refcounted, procedural language with ownership
Something went wrong. Try again.
1234567891011121314151617181920type Result*[T, E] { Ok(value: T) Err(error: E)}fn is-ok*[T, E](result: &Result[T, E]) bool = match result { Result.Ok(_) -> true Result.Err(_) -> false }fn is-err*[T, E](result: &Result[T, E]) bool = !result.is-ok()fn map*[A, B, E](result: Result[A, E], f: fn(A) B) Result[B, E] = match result { Result.Ok(v) -> Result.Ok(f(v)) Result.Err(e) -> Result.Err(e) }