Tagged
Handle tagged value tuples, such as {:ok, value} and {:error, reason}, in
various ways, by constructing macros for the regular matching constructs.
Construct and Destructure
defmodule Tagged.Status
use Tagged
deftagged ok
deftagged error
end
iex> use Tagged.Status
iex> ok(:computer)
{:ok, :computer}
iex> with error(reason) <- {:ok, :computer}, do: raise reason
{:ok, :computer}
Guard Statements
TODO:
Pipe filters
TBD
Installation
If available in Hex, the package can be installed
by adding tagged to your list of dependencies in mix.exs:
def deps do
[
{:tagged, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/tagged.