term-rewriting-0.3: Term Rewriting Library
Data.Rewriting.Term.Type
data Term f v Source #
Constructors
Variable
Function application
Defined in Data.Rewriting.Term.Type
Methods
(==) :: Term f v -> Term f v -> Bool #
(/=) :: Term f v -> Term f v -> Bool #
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 #
showsPrec :: Int -> Term f v -> ShowS #
show :: Term f v -> String #
showList :: [Term f v] -> ShowS #
Defined in Data.Rewriting.Term.Pretty
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
>>>
fold (\v -> 1) (\f xs -> 1 + sum xs) (Fun 'f' [Var 1, Fun 'g' []])
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' []]
map succ pred (Fun 'f' [Var 2, Fun 'g' []])