ark v0.5.4 Ark.Ok View Source
Link to this section Summary
Functions
Wrapping ok.
Questionning ok.
Unwrapping ok.
Unwrapping ok with raise.
wok
is an alias of wrapping function :ok
.
Link to this section Functions
Wrapping ok.
Converts a value to an :ok
tuple, except when the value is:
- the single atom
:ok
or an:ok
tuple - the single atom
:error
or an:error
tuple
Questionning ok.
Returns true
if the value is an {:ok, val}
tuple or the single
atom :ok
.
Returns false
otherwise.
Unwrapping ok.
Unwraps an {:ok, val}
tuple, giving only the value, returning anything else
as-is. Does not unwrap {:error, ...}
tuples.
This function should not be used as it leads to ambiguous code where errors
are still wrapped in tuples but values are "naked". A case pattern matching on
that type would be very unusual in Elixir/Erlang. Match on the original value
or use uok!/1
.
Unwrapping ok with raise.
Unwraps an {:ok, val}
tuple, giving only the value, or returns the single
:ok
atom as-is. Raises with any other value.
wok
is an alias of wrapping function :ok
.