ExDatalog.Constraints.Type (ExDatalog v0.2.0)

Copy Markdown View Source

Type predicate constraint implementation for the Constraint behaviour.

Evaluates type-check constraints (:is_integer, :is_binary, :is_atom) which filter bindings based on the Elixir type of a bound value. These are unary constraints: only left is evaluated, right and result are nil.

Summary

Functions

Evaluates a type predicate constraint against a binding environment.

Functions

evaluate(constraint, binding, context)

Evaluates a type predicate constraint against a binding environment.

Accepts an IR.Constraint struct as produced by the compiler. Returns {:ok, binding} (unchanged) when the type check passes, or :filter when it fails or the input variable is unbound.