crow/result.crow (source)

result[ok, error] union

  • ok ok
  • error error

A result is either a success (ok) or failure (error) value.

This provides a more explicit alternative to throwing an exception.
Prefer this over throwing an exception if failure is likely.

==[t, u] bool(a (t, u) result, b (t, u) result) t equal, u equal

then[out, in, err] (out, err) result(a (in, err) result, f mut (out, err) result(in))

is-ok[t, u] bool(a (t, u) result)