Witchcraft v0.3.0 Witchcraft.Applicative.Operator

Summary

Functions

Infix alias for Witchcraft.Applicative.apply, with arguments reversed

Infix alias for Witchcraft.Applicative.apply. If chaining, be sure to wrap each layer in parentheses, as ~>> and ~> are left associative

Functions

func <<~ value

Specs

any <<~ any :: any

Infix alias for Witchcraft.Applicative.apply, with arguments reversed.

This version is preferred, as it makes chaining arguments along wrapped partial applications clearer when reading left-to-right.


iex> [&(&1 + 1), &(&1 * 10)] <<~ [1,2,3]
[2,3,4,10,20,30]

iex> (&(fn x -> x * &1 end)) <~ [1,2,3] <<~ [9,10,11]
[9,10,11,18,20,22,27,30,33]
bare_function <~ functor_value
functor_value ~> bare_function

See Witchcraft.Functor.lift/2.

value ~>> func

Specs

any ~>> any :: any

Infix alias for Witchcraft.Applicative.apply. If chaining, be sure to wrap each layer in parentheses, as ~>> and ~> are left associative.


iex> [1,2,3] ~>> [&(&1 + 1), &(&1 * 10)]
[2,3,4,10,20,30]

# iex> [9, 10] ~>> (Witchcraft.Applicative.Function.lift [1,2,3], &(fn x -> x + &1 end))
iex> [9, 10] ~>> ([1,2,3] ~> &(fn x -> x * &1 end))
[9, 10, 18, 20, 27, 30]