Algae v0.12.2 Algae.Maybe View Source
The sum of Algae.Maybe.Just
and Algae.Maybe.Nothing
.
Maybe represents the presence or absence of something.
Please note that nil
is actually a value, as it can be passed to functions!
nil
is not bottom!
Examples
iex> [1,2,3]
...> |> List.first()
...> |> case do
...> nil -> new()
...> head -> new(head)
...> end
%Algae.Maybe.Just{just: 1}
iex> []
...> |> List.first()
...> |> case do
...> nil -> new()
...> head -> new(head)
...> end
%Algae.Maybe.Nothing{}
Link to this section Summary
Functions
Put no value into the Maybe
context (ie: make it a Nothing
)
Put a value into the Maybe
context (ie: make it a Just
)
Link to this section Types
Link to this section Functions
Put no value into the Maybe
context (ie: make it a Nothing
)
Examples
iex> new()
%Algae.Maybe.Nothing{}