tagged v0.1.0 Tagged.Outcome View Source
Reasoning in terms of the outcome of an action.
iex> use Tagged.Outcome
iex> failure(:is_human)
{:error, :is_human}
iex> with success(it) <- {:ok, "Computer"}, do: "OK, #{it}!"
"OK, Computer!"
Link to this section Summary
Functions
Constructor for error
tagged value tuples. Can also be used
to destructure tuples.
Constructor for ok
tagged value tuples. Can also be used
to destructure tuples.
Link to this section Types
Link to this section Functions
Specs
Constructor for error
tagged value tuples. Can also be used
to destructure tuples.
iex> use Elixir.Tagged.Constructor
iex> with failure(val) <- {:error, :match}, do: val
:match
iex> with failure(_) <- {:not_error, :match}, do: true
{:not_error, :match}
Specs
Constructor for ok
tagged value tuples. Can also be used
to destructure tuples.
iex> use Elixir.Tagged.Constructor
iex> with success(val) <- {:ok, :match}, do: val
:match
iex> with success(_) <- {:not_ok, :match}, do: true
{:not_ok, :match}