View Source Newt behaviour (Newt v4.1.0)

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.

Summary

Callbacks

@callback validate(value :: any()) :: {:ok, any()} | {:error, String.t()}

Functions