Safe Haskell | None |
---|---|
Language | Haskell2010 |
A class for constraints for unification variables
Synopsis
- class (PartialOrd c, Semigroup c) => TypeConstraints c where
- generalizeConstraints :: c -> c
- toScopeConstraints :: c -> c
- class Monad m => MonadScopeConstraints c m where
- scopeConstraints :: m c
- class TypeConstraints (TypeConstraintsOf ast) => HasTypeConstraints (ast :: Knot -> *) where
- type TypeConstraintsOf (ast :: Knot -> Type) :: Type
- verifyConstraints :: TypeConstraintsOf ast -> Tree ast k -> Maybe (Tree ast (WithConstraint k))
- data WithConstraint k ast = WithConstraint {
- _wcConstraint :: TypeConstraintsOf (GetKnot ast)
- _wcBody :: k ast
- wcConstraint :: forall k ast. Lens' (WithConstraint k ast) (TypeConstraintsOf (GetKnot ast))
- wcBody :: forall k ast k. Lens (WithConstraint k ast) (WithConstraint k ast) (k ast) (k ast)
Documentation
class (PartialOrd c, Semigroup c) => TypeConstraints c where Source #
A class for constraints for unification variables.
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
Instances
TypeConstraints ScopeLevel Source # | |
Defined in AST.Infer.ScopeLevel |
class Monad m => MonadScopeConstraints c m where Source #
A class for unification monads with scope levels
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
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
.
WithConstraint | |
|
wcConstraint :: forall k ast. Lens' (WithConstraint k ast) (TypeConstraintsOf (GetKnot ast)) Source #
wcBody :: forall k ast k. Lens (WithConstraint k ast) (WithConstraint k ast) (k ast) (k ast) Source #