| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Zabt.Internal.Term
- data Term v f a = Term {}
- type Flat v f = Term v f G
- freeVars :: Term v f a -> Set v
- embed :: (Ord v, Visits f) => Nameless v f (Term v f) a -> Term v f a
- var :: (Visits f, Ord v) => v -> Flat v f
- abstract :: forall v f a. (Visits f, Ord v) => v -> Term v f a -> Term v f a
- substitute :: forall v f a. (Visits f, Ord v) => v -> Term v f a -> Term v f a
- substitute' :: forall v f a. (Visits f, Ord v) => Flat v f -> Term v f a -> Term v f a
- subst :: forall v f a. (Visits f, Ord v) => (v -> Maybe (Flat v f)) -> Term v f a -> Term v f a
- substMap :: forall v f a. (Visits f, Ord v) => Map v (Flat v f) -> Term v f a -> Term v f a
- subst1 :: forall v f a. (Visits f, Ord v) => (v, Flat v f) -> Term v f a -> Term v f a
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 'Zabt.View.VAbs and VVar.
Instances
| (Eq v, Eq (f (Term v f)), Eq (Term v f a)) => Eq (Term v f (B a)) Source # | |
| (Eq v, Eq (f (Term v f))) => Eq (Term v f G) Source # | |
| (Ord v, Ord (f (Term v f)), Ord (Term v f a)) => Ord (Term v f (B a)) Source # | |
| (Ord v, Ord (f (Term v f))) => Ord (Term v f G) Source # | |
| (Show v, Show (Nameless v f (Term v f) a)) => Show (Term v f a) Source # | |
freeVars :: Term v f a -> 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 :: forall v f a. (Visits f, Ord v) => (v -> Maybe (Flat v f)) -> Term v f a -> Term v f a Source #
Substitute some free variables.