Algae v0.12.1 Algae.Either
Represent branching conditions. These could be different return types, error vs nominal value, and so on.
Examples
iex> require Integer
...> value = 11
...> if Integer.is_even(value) do
...> right(value)
...> else
...> left(value)
...> end
%Algae.Either.Left{left: 11}
iex> require Integer
...> value = 10
...> if Integer.is_even(value) do
...> right(value)
...> else
...> left(value)
...> end
%Algae.Either.Right{right: 10}
Summary
Types
Functions
Specs
left(any) :: Algae.Either.Left.t
Wrap a value in the Left
branch
Examples
iex> left(13)
%Algae.Either.Left{left: 13}
Specs
right(any) :: Algae.Either.Right.t
Wrap a value in the Right
branch
Examples
iex> right(7)
%Algae.Either.Right{right: 7}