compdata-0.3: Compositional Data Types

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerPatrick Bahr <paba@diku.dk>

Data.Comp.Multi.Variables

Description

This module defines an abstract notion of (bound) variables in compositional data types, and scoped substitution. Capture-avoidance is not taken into account. All definitions are generalised versions of those in Data.Comp.Variables.

Synopsis

Documentation

class HasVars f v whereSource

This multiparameter class defines functors with variables. An instance HasVar f v denotes that values over f might contain and bind variables of type v.

Methods

isVar :: f a :=> Maybe vSource

bindsVars :: f a :=> [v]Source

Instances

HasVars f v => HasVars (Cxt h f) v 
(HasVars f v[a1ldN], HasVars g v[a1ldN]) => HasVars (:+: f g) v[a1ldN] 

type GSubst v a = NatM Maybe (K v) aSource

type CxtSubst h a f v = GSubst v (Cxt h f a)Source

varsToHoles :: forall f v. (HFunctor f, HasVars f v, Eq v) => Term f :-> Context f (K v)Source

containsVar :: (Eq v, HasVars f v, HFoldable f, HFunctor f) => v -> Cxt h f a :=> BoolSource

This function checks whether a variable is contained in a context.

variables :: (Ord v, HasVars f v, HFoldable f, HFunctor f) => Cxt h f a :=> Set vSource

This function computes the set of variables occurring in a context.

variableList :: (HasVars f v, HFoldable f, HFunctor f, Eq v) => Cxt h f a :=> [v]Source

This function computes the list of variables occurring in a context.

variables' :: (Ord v, HasVars f v, HFoldable f, HFunctor f) => Const f :=> Set vSource

This function computes the set of variables occurring in a context.

substVars :: SubstVars v t a => GSubst v t -> a :-> aSource

appSubst :: SubstVars v t a => GSubst v t -> a :-> aSource

compSubst :: (Ord v, HasVars f v, HFunctor f) => CxtSubst h a f v -> CxtSubst h a f v -> CxtSubst h a f vSource

This function composes two substitutions s1 and s2. That is, applying the resulting substitution is equivalent to first applying s2 and then s1.