Handlex v1.0.2 Handlex View Source

Handlex - syntax sugar package.

Link to this section Summary

Functions

Pipe operator with pattern matching for {:error, value} tuple, passes value to right. If not matched returns left, ignoring right.

Pipe operator with pattern matching for {:ok, value} tuple, passes value to right. If not matched returns left, ignoring right.

Link to this section Functions

Pipe operator with pattern matching for {:error, value} tuple, passes value to right. If not matched returns left, ignoring right.

Examples

iex> {:error, 10} <~ Kernel.*(10)
100
iex> {:ok, 10} <~ Kernel.*(10)
{:ok, 10}
iex> 10 <~ Kernel.*(10)
10

Pipe operator with pattern matching for {:ok, value} tuple, passes value to right. If not matched returns left, ignoring right.

Examples

iex> {:ok, 10} ~> Kernel.*(10)
100
iex> {:error, 10} ~> Kernel.*(10)
{:error, 10}
iex> 10 ~> Kernel.*(10)
10