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 around ok/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 in error 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} over Enumerables.

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

Types

p()

:ok | {:error, any}

s()

{:ok, any} | {:error, any}

{:ok, x} | {:error, any}

t()

:ok | {:ok, any} | {:error, any}

:ok | {:ok, x} | {:error, any}

Link to this section Types

:ok | {:error, any}

{:ok, any} | {:error, any}

{:ok, x} | {:error, any}

:ok | {:ok, any} | {:error, any}

:ok | {:ok, x} | {:error, any}