Domo v0.1.1 Domo.TypeContract View Source

A module to validate a type contract

Link to this section Summary

Link to this section Functions

Link to this function

match_spec?(term, spec, metadata)

View Source

See Domo.TypeSpecMatchable.match_spec?/3.

Link to this function

valid?(value, contract, env)

View Source

Specs

valid?(any(), Macro.t(), Macro.Env.t()) :: boolean()

Validates if the value matches the @type contract.

The contract is a type spec in Elixir quoted form. The environment is a module's environment to resolve aliases for remote types. Usually, it should be a caller environment that the Kernel.SpecialForms.__ENV__/0 macro returns.