TODO: Add description
Buildable
is a protocol that allows users to build terms that implement this protocol.
The very basic version of any term type can be implemented with only three functions:
empty/1
: which returns the empty representation of the term;insert/3
: which inserts an element into the term;extract/2
: which extracts an element out of the term.
There are other two protocols that get automatically implemeneted, based on the fallback implementations for Buildable
,
which are:
Buildable.Collectable
: it collects elements into a buildable term. It is analog to Elixir core'sCollectable
, with a minor improvement.Buildable.Reducible
: it reduces the buildable into an element. It is analog to Elixir core'sEnumerable.reduce/3
.
If available in Hex, the package can be installed
by adding buildable
to your list of dependencies in mix.exs
:
def deps do
[
{:buildable, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/buildable.