elixir-monad
elixir-monad copied to clipboard
ErrorM treat everything but {:ok, value} as an error
There are some(many) functions like Elixirs List.from_char_data
from_char_data(char_data) :: {:ok, char_list} | {:error, [], binary} | {:incomplete, [], binary}
In such a case I only really care about the success case of {:ok, char_list}. I would like to treat everything else as an error.
Would you accept a Pull Request for an ErrorMStrict or such with a bind function like
def bind(x, f)
def bind({:ok, a}, f) do
f.(a)
end
def bind(error, _f) do
error
end