syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellNone
LanguageHaskell2010

AST.Unify.Constraints

Description

A class for constraints for unification variables

Synopsis

Documentation

class (PartialOrd c, Semigroup c) => TypeConstraints c where Source #

A class for constraints for unification variables.

Methods

generalizeConstraints :: c -> c Source #

Remove scope constraints.

When generalizing unification variables into universally quantified variables, and then into fresh unification variables upon instantiation, some constraints need to be carried over, and the "scope" constraints need to be erased.

toScopeConstraints :: c -> c Source #

Remove all constraints other than the scope constraints

Useful for comparing constraints to the current scope constraints

class Monad m => MonadScopeConstraints c m where Source #

A class for unification monads with scope levels

Methods

scopeConstraints :: m c Source #

Get the current scope constraint

class TypeConstraints (TypeConstraintsOf ast) => HasTypeConstraints (ast :: Knot -> *) where Source #

A class for terms that have constraints.

A dependency of Unify

Associated Types

type TypeConstraintsOf (ast :: Knot -> Type) :: Type Source #

Methods

verifyConstraints :: TypeConstraintsOf ast -> Tree ast k -> Maybe (Tree ast (WithConstraint k)) Source #

Verify constraints on the ast and apply the given child verifier on children

data WithConstraint k ast Source #

A Knot to represent a term alongside a constraint.

Used for verifyConstraints.

Constructors

WithConstraint 

Fields

wcBody :: forall k ast k. Lens (WithConstraint k ast) (WithConstraint k ast) (k ast) (k ast) Source #