flocc-pffb

Stabilityexperimental
Maintainerdeveloper@flocc.net
Safe HaskellSafe-Inferred

Compiler.Types2.Variables

Description

For more information please see http://www.flocc.net/

Synopsis

Documentation

class VarsIn a where

A type that contains variables

Methods

isVar :: a -> Maybe Idx

getVars :: a -> Set Idx

newVar :: Idx -> a

applyVarSubsts :: VarSubsts a -> a -> a

Instances

VarsIn (Term l t) 

type VarSubsts a = IntMap a

Substs is a Map of substitutions from var ids |to terms.

applyVarSubst :: VarsIn a => VarSubsts a -> Idx -> a

applyVarSubst takes a map of substitutions and a var id |and returns the substituted value if there is one, or |Var i if there isn't.

fromList :: VarsIn a => [(Idx, a)] -> VarSubsts a

fromList takes a list of (var id, VarsIn) pairs |and returns a VarSubsts for that list such that |subs are applied from left to right (left first...)

fromDisjointList :: VarsIn a => [(Idx, a)] -> VarSubsts a

fromDisjointList takes a list of disjoint (Var id, VarsIn) pairs |and returns a VarSubsts.

composeVarSubsts :: VarsIn a => VarSubsts a -> VarSubsts a -> VarSubsts a

composeSubsts a b sequentially composes a and b |such that a is applied after b.

newVars :: (Monad m, VarsIn a) => Set Idx -> a -> StateT IdxSet m a

newVars varsToChange a, takes |a list of var ids to change, and an instance of VarsIn and returns |the same VarsIn a with the var ids to change replaced with new ones |from the newids in the state monad.

emptyVarSubsts :: IntMap a

emptyVarSubsts is an empty set of substitutions