View Source TypeCheck.Builtin.FixedMap (TypeCheck v0.13.7)
Checks whether the value is a map with a required set of keys
On failure returns a problem tuple with:
:not_a_mapif the value is not a map:missing_keysif the value does not have all of the expected keys. The extra information contains in this case:keyswith a list of keys that are missing.:superfluous_keysif the value have any keys other than the expected keys. The extra information contains in this case:keyswith a list of keys that are superfluous.:value_errorif one of the elements does not match. The extra information contains in this case:problemand:keyto indicate what and where the problem occurred.
Summary
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()})}