Witchcraft v0.5.0 Witchcraft.Functor.Function

Functions that come directly from lift

Summary

Functions

Not strictly a curried version of lift/2. lift/1 partially applies a function, to create a “lifted” version of that function

Replace all of the input’s data nodes with some constant value

Functions

lift()

Not strictly a curried version of lift/2. lift/1 partially applies a function, to create a “lifted” version of that function.

Examples

iex> x10 = &lift(fn x -> x * 10 end).(&1)
...> [1,2,3] |> x10.()
[10,20,30]

# iex> x10 = &lift(fn x -> x * 10 end).(&1)
# ...> %Algae.Id{id: 13} |> x10.()
# %Algae.Id{id: 130}
lift(fun)

Specs

lift((... -> any)) :: (any -> any)
replace(data, const)

Specs

replace(any, any) :: any

Replace all of the input’s data nodes with some constant value

Examples

iex> [1,2,3] |> replace(42)
[42, 42, 42]