Witchcraft.Semigroup.Proto protocol (Witchcraft v1.0.4) View Source
Protocol for the Elixir.Witchcraft.Semigroup type class
For this type class's API, please refer to Elixir.Witchcraft.Semigroup
Link to this section Summary
Functions
appendenate two data of the same type. These can be chained together an arbitrary number of times. For example
Link to this section Types
Specs
t() :: term()
Link to this section Functions
appendenate two data of the same type. These can be chained together an arbitrary number of times. For example:
iex> 1 |> append(2) |> append(3)
6
iex> [1, 2, 3]
...> |> append([4, 5, 6])
...> |> append([7, 8, 9])
[1, 2, 3, 4, 5, 6, 7, 8, 9]
iex> "foo" |> append(" ") |> append("bar")
"foo bar"Operator
iex> use Witchcraft.Semigroup
...> 1 <> 2 <> 3 <> 5 <> 7
18
iex> use Witchcraft.Semigroup
...> [1, 2, 3] <> [4, 5, 6] <> [7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
iex> use Witchcraft.Semigroup
...> "foo" <> " " <> "bar"
"foo bar"There is an operator alias a <> b. Since this conflicts with Kernel.<>/2,
use Witchcraft,Semigroup will automatically exclude the Kernel operator.
This is highly recommended, since <> behaves the same on bitstrings, but is
now available on more datatypes.