O'Reilly logo
  • BillSubs Engineer thinks this is interesting:

The with Expression

From

Cover of Programming Elixir 1.3

Note

The most basic function chaining structure that elixir has is the pipe |>, which simply chains the output of (function A |> function B) to the first parameter of function B. A common pattern in erlang libraries is to return the tuple {:ok, result} or {:error, message}, which can't easily be piped. The with operator allows chaining with and decomposable result