exchema v0.4.0 Exchema.Type behaviour

This is the contract of a type module.

To implement your own type you should just implement the ___type__/1 callback which receives a tuple with your type arguments. If you have a concrete type, then it should match on receiving an empty tuple {}.

Link to this section Summary

Functions

Resolves a type reference into it’s definition

Link to this section Types

Link to this type predicate_reference()
predicate_reference() :: {module(), atom()} | atom()
Link to this type predicate_spec()
predicate_spec() :: {predicate_reference(), any()}
Link to this type refined_type()
refined_type() :: {:ref, t(), [predicate_spec()]}
Link to this type t()
t() :: module()
Link to this type type_params()
type_params() :: tuple()
Link to this type type_reference()
type_reference() :: Type.t() | {Type.t(), type_params()}

Link to this section Functions

Link to this function resolve_type(type)
resolve_type(type_reference()) :: spec()

Resolves a type reference into it’s definition

Link to this section Callbacks

Link to this callback __type__(type_params)
__type__(type_params()) :: spec()