tagged v0.1.0 Tagged.Status View Source

Resoning in terms of the status of a result.

iex> use Tagged.Status
iex> ok(:computer)
{:ok, :computer}
iex> with ok(it) <- Keyword.fetch([a: "bacon"], :a), do: "Chunky #{it}!"
"Chunky bacon!"

Link to this section Summary

Types

Tagged value tuple, containing term().

Tagged value tuple, containing term().

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

Specs

error() :: {:error, term()}

Tagged value tuple, containing term().

Specs

ok() :: {:ok, term()}

Tagged value tuple, containing term().

Link to this section Functions

Specs

error(term()) :: error()

Constructor for error tagged value tuples. Can also be used to destructure tuples.

iex> use Elixir.Tagged.Constructor
iex> with error(val) <- {:error, :match}, do: val
:match
iex> with error(_) <- {:not_error, :match}, do: true
{:not_error, :match}

Specs

ok(term()) :: ok()

Constructor for ok tagged value tuples. Can also be used to destructure tuples.

iex> use Elixir.Tagged.Constructor
iex> with ok(val) <- {:ok, :match}, do: val
:match
iex> with ok(_) <- {:not_ok, :match}, do: true
{:not_ok, :match}