Brex.Result v0.4.0 Brex.Result View Source
This library provides tools to handle three common return values in Elixir
:ok | {:ok, value} | {:error, reason}
Brex.Result
is split into three main components:
Brex.Result.Base
- Base provides tools for creating and passing aroundok
/error
tuples. The tools follow the property: if there’s a success continue the computation, if there’s an error propagate it.Brex.Result.Helpers
- Helpers includes tools for modifying the reason inerror
tuples. The functions in this module always propogate the success value.Brex.Result.Mappers
- Mappers includes tools for applying functions that return:ok | {:ok, val} | {:error, reason}
overEnumerables
.
To import the entire library:
use Brex.Result
To import the modules individually:
import Brex.Result.Base
import Brex.Result.Helpers
import Brex.Result.Mappers
Link to this section Summary
Link to this section Types
Link to this type
p()
View Source
p()
View Source
p() :: Brex.Result.Base.p()
p() :: Brex.Result.Base.p()
:ok | {:error, any}
Link to this type
s()
View Source
s()
View Source
s() :: Brex.Result.Base.s()
s() :: Brex.Result.Base.s()
{:ok, any} | {:error, any}
Link to this type
s(x)
View Source
s(x)
View Source
s(x) :: Brex.Result.Base.s(x)
s(x) :: Brex.Result.Base.s(x)
{:ok, x} | {:error, any}
Link to this type
t()
View Source
t()
View Source
t() :: Brex.Result.Base.t()
t() :: Brex.Result.Base.t()
:ok | {:ok, any} | {:error, any}
Link to this type
t(x)
View Source
t(x)
View Source
t(x) :: Brex.Result.Base.t(x)
t(x) :: Brex.Result.Base.t(x)
:ok | {:ok, x} | {:error, any}