Witchcraft v0.5.0 Witchcraft.Applicative.Function

Function helpers, derivatives and operators for Witchcraft.Applicative.Protocol

Summary

Functions

lift a function over 2 arguments

lift a function over 3 arguments

lift a function over 4 arguments

Sequentially seq, and discard the second value of each pair

Sequentially seq, and discard the first value of each pair

Types

applicative :: any

Functions

lift(val_1, val_2, fun)

Specs

lift(applicative, applicative, (... -> any)) :: applicative
lift(applicative, applicative, (... -> any)) :: applicative

lift a function over 2 arguments

Examples

iex> lift([1,2,3], [4,5,6], &(&1 + &2))
[5,6,7,6,7,8,7,8,9]
lift(val_1, val_2, val_3, fun)

Specs

lift(applicative, applicative, applicative, (... -> any)) :: applicative

lift a function over 3 arguments

Examples

iex> lift([1,2], [3,4], [5,6], &(&1 + &2 + &3))
[9,10,10,11,10,11,11,12]
lift(val_1, val_2, val_3, val_4, fun)

lift a function over 4 arguments

Examples

iex> lift([1,2], [3,4], [5,6], [7,8], &(&1 + &2 + &3 + &4))
[16,17,17,18,17,18,18,19,17,18,18,19,18,19,19,20]
rewrap(pre_wrapped)
seq_first(first, second)

Specs

seq_first(applicative, applicative) :: any

Sequentially seq, and discard the second value of each pair.

seq_second(first, second)

Specs

seq_second(applicative, applicative) :: any

Sequentially seq, and discard the first value of each pair.