croma v0.8.0 Croma.SubtypeOfList View Source
Helper module to define list-based types.
The following members are generated by use Croma.SubtypeOfList
:
@type t
@spec valid?(term) :: boolean
@spec new(term) :: Croma.Result.t(t)
Options:
:elem_module
- A type module for elements.:min_length
- Minimum length of valid values of this type (inclusive).:max_length
- Maximum length of valid values of this type (inclusive).:default
- Default value for this type. Passing this option generatesdefault/0
.
Examples
defmodule MyList do
use Croma.SubtypeOfList, elem_module: MyInt, default: []
end