View Source TypeCheck.Builtin.FixedMap (TypeCheck v0.12.0)
Checks whether the value is a list with the expected elements
On failure returns a problem tuple with:
:not_a_map
if the value is not a map:missing_keys
if the value does not have all of the expected keys. The extra information contains in this case:keys
with a list of keys that are missing.:superfluous_keys
if the value have any keys other than the expected keys. The extra information contains in this case:keys
with a list of keys that are superfluous.:value_error
if one of the elements does not match. The extra information contains in this case:problem
and:key
to indicate what and where the problem occured.
Link to this section Summary
Link to this section Types
@type problem_tuple() :: {t(), :not_a_map, %{}, any()} | {t(), :missing_keys, %{keys: [atom()]}, map()} | {t(), :superfluous_keys, %{keys: [atom()]}, map()} | {t(), :value_error, %{problem: TypeCheck.TypeError.Formatter.problem_tuple(), key: any()}, map()}
(This type is managed by TypeCheck
,
which allows checking values against the type at runtime.)
Full definition:
problem_tuple :: {t(), :not_a_map, %{}, any()}
| {t(), :missing_keys, %{keys: list(atom())}, map()}
| {t(), :superfluous_keys, %{keys: list(atom())}, map()}
| {t(), :value_error, %{problem: lazy(TypeCheck.TypeError.Formatter.problem_tuple()), key: any()},
map()}
@type t() :: %TypeCheck.Builtin.FixedMap{keypairs: [{term(), TypeCheck.Type.t()}]}
(This type is managed by TypeCheck
,
which allows checking values against the type at runtime.)
Full definition:
t :: %TypeCheck.Builtin.FixedMap{keypairs: list({term(), TypeCheck.Type.t()})}