Module constraint

Source

Structs§

AllEqualTypeConstraint
A type constraint that requires all or some arguments to have the same type.
Assignment
A mapping from variables to their assigned values. This is the result of constraint solving. Uses an immutable HashMap for efficient cloning during constraint solving.
Problem
A constraint satisfaction problem consisting of constraints and a range of variables to solve for. The problem is considered solved when all variables in the range are assigned.
SimpleTypeConstraint
A type constraint that assigns specific sorts to each argument position. Constructs a set of Assign constraints that fully constrain the type of arguments.

Enums§

ConstraintError
Errors that can occur during constraint solving. These represent various ways that constraint satisfaction can fail.
ImpossibleConstraint
Represents constraints that are logically impossible to satisfy. These are used to signal type errors during constraint solving.

Traits§

Constraint
A constraint that can be applied to variable assignments. Constraints are used in type inference to represent relationships between variables and values.
TypeConstraint
A trait for generating type constraints from atom applications. This is used to create constraints that ensure proper typing of function/primitive applications.

Functions§

and
Creates a conjunction constraint that requires all sub-constraints to be satisfied.
assign
Creates an assignment constraint that binds a variable to a specific value. The constraint fails if the variable is already assigned to a different value.
eq
Creates an equality constraint between two variables. If one of the variable has a known value, the constraint propagates value to the other variable. If both variables have known but different values, the constraint fails.
implies
Creates an implication constraint that activates when all watch variables are assigned. The constraint function is called with the values of the watch variables to generate the actual constraint.
impossible
Creates a constraint that always fails with the given impossible constraint. This is used to signal type errors during constraint solving.
xor
Creates an exclusive-or constraint that requires exactly one sub-constraint to be satisfied. The constraint proceeds if exactly one sub-constraint can be satisfied and all others lead to failure. The constraint fails if zero sub-constraints can be satisfied.

Type Aliases§

DelayedConstraintFn