Witchcraft.Applicative.Proto protocol (Witchcraft v1.0.4) View Source
Protocol for the Elixir.Witchcraft.Applicative
type class
For this type class's API, please refer to Elixir.Witchcraft.Applicative
Link to this section Summary
Functions
Bring a value into the same data type as some sample
Link to this section Types
Specs
t() :: term()
Link to this section Functions
Specs
of(Witchcraft.Applicative.t(), any()) :: Witchcraft.Applicative.t()
Bring a value into the same data type as some sample
Examples
iex> of([], 42)
[42]
iex> of([1, 2, 3], 42)
[42]
iex> of({"a", "b", 155}, 42)
{"", "", 42}
iex> of(fn -> nil end, 42).(55)
42
iex> of(fn(a, b, c) -> a + b - c end, 42).(55)
42
iex> import Witchcraft.Apply
...>
...> []
...> |> of(&+/2)
...> |> provide([1, 2, 3])
...> |> ap(of([], 42))
[43, 44, 45]