Witchcraft.Semigroupoid.Proto protocol (Witchcraft v1.0.4) View Source
Protocol for the Elixir.Witchcraft.Semigroupoid
type class
For this type class's API, please refer to Elixir.Witchcraft.Semigroupoid
Link to this section Summary
Functions
Express how to apply arguments to the very end of a semigroupoid, or "run the morphism". This should not be used to inject values part way though a composition chain.
Take two morphisms and return their composition "the math way".
That is, (b -> c) -> (a -> b) -> (a -> c)
.
Link to this section Types
Specs
t() :: term()
Link to this section Functions
Specs
apply(Witchcraft.Semigroupoid.t(), [any()]) :: Witchcraft.Semigroupoid.t() | any()
Express how to apply arguments to the very end of a semigroupoid, or "run the morphism". This should not be used to inject values part way though a composition chain.
It is provided here to remain idiomatic with Elixir, and to make prop testing possible.
Examples
iex> Witchcraft.Semigroupoid.apply(&inspect/1, [42])
"42"
Specs
compose(Witchcraft.Semigroupoid.t(), Witchcraft.Semigroupoid.t()) :: Witchcraft.Semigroupoid.t()
Take two morphisms and return their composition "the math way".
That is, (b -> c) -> (a -> b) -> (a -> c)
.
Examples
iex> times_ten_plus_one = compose(fn x -> x + 1 end, fn y -> y * 10 end)
...> times_ten_plus_one.(5)
51