term-rewriting-0.3: Term Rewriting Library

Safe HaskellSafe
LanguageHaskell98

Data.Rewriting.Term.Type

Synopsis

Documentation

data Term f v Source #

Constructors

Var v

Variable

Fun f [Term f v]

Function application

Instances
(Eq v, Eq f) => Eq (Term f v) Source # 
Instance details

Defined in Data.Rewriting.Term.Type

Methods

(==) :: Term f v -> Term f v -> Bool #

(/=) :: Term f v -> Term f v -> Bool #

(Ord v, Ord f) => Ord (Term f v) Source # 
Instance details

Defined in Data.Rewriting.Term.Type

Methods

compare :: Term f v -> Term f v -> Ordering #

(<) :: Term f v -> Term f v -> Bool #

(<=) :: Term f v -> Term f v -> Bool #

(>) :: Term f v -> Term f v -> Bool #

(>=) :: Term f v -> Term f v -> Bool #

max :: Term f v -> Term f v -> Term f v #

min :: Term f v -> Term f v -> Term f v #

(Show v, Show f) => Show (Term f v) Source # 
Instance details

Defined in Data.Rewriting.Term.Type

Methods

showsPrec :: Int -> Term f v -> ShowS #

show :: Term f v -> String #

showList :: [Term f v] -> ShowS #

(Pretty f, Pretty v) => Pretty (Term f v) # 
Instance details

Defined in Data.Rewriting.Term.Pretty

Methods

pretty :: Term f v -> Doc #

prettyList :: [Term f v] -> Doc #

fold :: (v -> a) -> (f -> [a] -> a) -> Term f v -> a Source #

Folding terms.

>>> fold (\v -> 1) (\f xs -> 1 + sum xs) (Fun 'f' [Var 1, Fun 'g' []])
3 -- size of the given term

map :: (f -> f') -> (v -> v') -> Term f v -> Term f' v' Source #

Mapping terms: Rename function symbols and variables.

>>> map succ pred (Fun 'f' [Var 2, Fun 'g' []])
Fun 'e' [Var 3,Fun 'f' []]