TypeCheck v0.2.0 TypeCheck.Builtin.FixedList View Source
Checks whether the value is a list with the expected elements
On failure returns a problem tuple with:
:not_a_listif the value is not a list:different_lengthif the value is a list but not of equal size.:element_errorif one of the elements does not match. The extra information contains in this case:problemand:indexto indicate what and where the problem occured.
Link to this section Summary
Link to this section Types
Specs
problem_tuple() ::
{t(), :not_a_list, %{}, any()}
| {t(), :different_length, %{expected_length: non_neg_integer()}, list()}
| {t(), :element_error,
%{
problem: TypeCheck.TypeError.Formatter.problem_tuple(),
index: integer()
}, list()}
This type is managed by TypeCheck,
which allows checking values against the type at runtime.
Full definition:
problem_tuple :: {t(), :not_a_list, %{}, any()} | {t(), :different_length, %{expected_length: non_neg_integer()}, list()} | {t(), :element_error, %{problem: lazy(TypeCheck.TypeError.Formatter.problem_tuple()), index: integer()}, list()} Specs
t() :: %TypeCheck.Builtin.FixedList{element_types: list()}
This type is managed by TypeCheck,
which allows checking values against the type at runtime.
Full definition:
t :: %TypeCheck.Builtin.FixedList{element_types: list()}