TypeCheck v0.2.0 TypeCheck.Builtin.FixedMap View Source

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.
  • :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

Types

This type is managed by TypeCheck, which allows checking values against the type at runtime.

t()

This type is managed by TypeCheck, which allows checking values against the type at runtime.

Link to this section Types

Specs

problem_tuple() ::
  {t(), :not_a_map, %{}, any()}
  | {t(), :missing_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(), :value_error, %{problem: lazy(TypeCheck.TypeError.Formatter.problem_tuple()), key: any()}, map()}

Specs

t() :: %TypeCheck.Builtin.FixedMap{keypairs: [{any(), any()}]}

This type is managed by TypeCheck, which allows checking values against the type at runtime.

Full definition:

t :: %TypeCheck.Builtin.FixedMap{keypairs: list({any(), any()})}