Algae.Either (Algae v1.3.1) View Source

Represent branching conditions. These could be different return types, error vs nominal value, and so on.

Examples

iex> require Integer
...>
...> even_odd = fn(value) ->
...>   if Integer.is_even(value) do
...>     Algae.Either.Right.new(value)
...>   else
...>     Algae.Either.Left.new(value)
...>   end
...> end
...>
...> even_odd.(10)
%Algae.Either.Right{right: 10}
...> even_odd.(11)
%Algae.Either.Left{left: 11}

Link to this section Summary

Link to this section Types

Link to this section Functions