Arrows (arrows v0.1.0)
A handful of (mostly) arrow macros with superpowers.
Summary
Functions
Like ||
, except only defaults if the left is nil (i.e. false is valid)
Like ||
, except with the logic applied by ~>
A more flexible drop-in replacement for the standard elixir pipe operator.
Like OK.~>
Functions
Like ||
, except only defaults if the left is nil (i.e. false is valid)
Like ||
, except with the logic applied by ~>
Link to this function
from_ok(x)
Link to this function
ok(x)
Link to this function
ok_or(x, err)
Link to this function
to_ok(x)
A more flexible drop-in replacement for the standard elixir pipe operator.
Special features are unlocked when using the ...
(ellipsis) on the right hand side:
- The right hand side need not be a function, it can be any expression containing the ellipsis.
- The ellipsis will be replaced with the result of evaluating the hand side expression.
- You may use the ellipsis multiple times and the left hand side will be calculated exactly once.
You can do crazy stuff with the ellipsis, but remember that people have to read it!
Like OK.~>