Safe Haskell | None |
---|---|
Language | Haskell2010 |
First-order rewriting
- matchM :: (Functor f, Foldable f, EqF f) => LHS f a -> Term f -> WriterT (Subst f) Maybe ()
- solveTerm :: EqF f => [Term f] -> Maybe (Term f)
- solveSubst :: EqF f => [(Name, Term f)] -> Maybe (Subst f)
- match :: (Functor f, Foldable f, EqF f) => LHS f a -> Term f -> Maybe (Subst f)
- substitute :: Traversable f => Subst f -> RHS f a -> Maybe (Term f)
- rewrite :: (Traversable f, EqF f) => Rule (LHS f) (RHS f) -> Term f -> Maybe (Term f)
- applyFirst :: (Traversable f, EqF f) => [Rule (LHS f) (RHS f)] -> Term f -> Term f
- bottomUp :: (Traversable f, EqF f) => [Rule (LHS f) (RHS f)] -> Term f -> Term f
- topDown :: (Traversable f, EqF f) => [Rule (LHS f) (RHS f)] -> Term f -> Term f
Documentation
matchM :: (Functor f, Foldable f, EqF f) => LHS f a -> Term f -> WriterT (Subst f) Maybe () Source
First-order matching. Results in a list of candidate mappings.
This function assumes that there are no applications of meta-variables in LHS
.
solveTerm :: EqF f => [Term f] -> Maybe (Term f) Source
Check if all terms are equal, and if so, return one of them
solveSubst :: EqF f => [(Name, Term f)] -> Maybe (Subst f) Source
Turn a list of candidate mappings into a substitution. Succeeds iff. all mappings for the same variable are equal.
match :: (Functor f, Foldable f, EqF f) => LHS f a -> Term f -> Maybe (Subst f) Source
First-order matching. Succeeds if the pattern matches and all occurrences of a given meta-variable are matched against equal terms.
This function assumes that there are no applications of meta-variables in LHS
.
substitute :: Traversable f => Subst f -> RHS f a -> Maybe (Term f) Source
applyFirst :: (Traversable f, EqF f) => [Rule (LHS f) (RHS f)] -> Term f -> Term f Source