View Source Croma.SubtypeOfList (croma v0.11.3)
Helper module to define list-based types.
The following members are generated by use Croma.SubtypeOfList
:
@type t
@spec valid?(term) :: boolean
- If
elem_module
exportsnew/1
,@spec new(term) :: Croma.Result.t(t)
@spec new!(term) :: 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
Examples
defmodule MyList do
use Croma.SubtypeOfList, elem_module: MyInt, default: []
end