Witchcraft.Arrow.Proto protocol (Witchcraft v1.0.4) View Source

Protocol for the Elixir.Witchcraft.Arrow type class

For this type class's API, please refer to Elixir.Witchcraft.Arrow

Link to this section Summary

Functions

Lift a function into an arrow, much like how of/2 does with data.

Link to this section Types

Link to this section Functions

Specs

arrowize(Witchcraft.Arrow.t(), (... -> any())) :: Witchcraft.Arrow.t()

Lift a function into an arrow, much like how of/2 does with data.

Essentially a label for composing functions end-to-end, where instances may have their own special idea of what composition means. The simplest example is a regular function. Others are possible, such as Kleisli arrows.

Examples

iex> use Witchcraft.Arrow
...> times_ten = arrowize(fn -> nil end, &(&1 * 10))
...> 5 |> pipe(times_ten)
50