A low-cost abstraction implementing the NewType pattern in Elixir
There is no way (currently) to define zero-cost NewTypes in Elixir (like you can in Rust, Haskell, F#, etc.) because Elixir is dynamically typed. However, this library provides a low-cost abstraction that allows you to define NewTypes in Elixir with minimal boilerplate.
If available in Hex, the package can be installed
by adding newt
to your list of dependencies in mix.exs
:
def deps do
[
{:newt, "~> 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/newt.