Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data Term v f = Term {}
- freeVars :: Term v f -> Set v
- embed :: (Ord v, Foldable f) => Nameless v f (Term v f) -> Term v f
- var :: (Foldable f, Ord v) => v -> Term v f
- abstract :: (Foldable f, Functor f, Ord v) => v -> Term v f -> Term v f
- substitute :: (Functor f, Foldable f, Ord v) => v -> Term v f -> Term v f
- substitute' :: (Functor f, Foldable f, Ord v) => Term v f -> Term v f -> Term v f
- subst :: (Functor f, Foldable f, Ord v) => (v -> Maybe (Term v f)) -> Term v f -> Term v f
- substMap :: (Functor f, Foldable f, Ord v) => Map v (Term v f) -> Term v f -> Term v f
- subst1 :: (Functor f, Foldable f, Ord v) => (v, Term v f) -> Term v f -> Term v f
Documentation
An abstract
is an abstract binding tree of the shape described
by the pattern functor Term
v ff
augmented with variables named by v
. Equality is
alpha-equivalence. In particular,
is (morally) equivalent to the
fixed-point of the pattern-algebra Term
v fView
respecting the binding
properties of VAbs
and VVar
.
freeVars :: Term v f -> Set v Source #
Returns the free variables used within a given Term
.
NOTE: We have to define a new function in order to not accidentally break
encapsulation. Just exporting free
direction would allow uses to manipulate
the Term value and break invariants (!).
subst :: (Functor f, Foldable f, Ord v) => (v -> Maybe (Term v f)) -> Term v f -> Term v f Source #
Substitute some free variables.