happy_with v0.0.1 HappyWith
Summary
Macros
Rewrites the given block and else clauses into Elixir’s standard with
form
Macros
Rewrites the given block and else clauses into Elixir’s standard with
form.
iex> import HappyWith iex> happy_with do …> {:ok, name} <- {:ok, “joSE”} …> lower = String.downcase(name) …> lower …> end “jose”
You can also provide else clauses to the with
form.
iex> import HappyWith iex> happywith do …> {:ok, name} <- {:error, :nobody} …> _never_reached = String.downcase(name) …> else …> {:error, } -> “luis” …> end “luis”