Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- data Term f v
- fold :: (v -> a) -> (f -> [a] -> a) -> Term f v -> a
- map :: (f -> f') -> (v -> v') -> Term f v -> Term f' v'
- vars :: Term f v -> [v]
- funs :: Term f v -> [f]
- module Data.Rewriting.Term.Type
- module Data.Rewriting.Term.Ops
- module Data.Rewriting.Term.Pretty
- module Data.Rewriting.Term.Parse
Documentation
Important operations
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' []]
vars :: Term f v -> [v] Source #
Return the list of all variables in the term, from left to right.
>>>
vars (Fun 'g' [Var 3, Fun 'f' [Var 1, Var 2, Var 3]])
[3,1,2,3]
funs :: Term f v -> [f] Source #
Return the list of all function symbols in the term, from left to right.
>>>
funs (Fun 'f' [Var 3, Fun 'g' [Fun 'f' []]])
"fgf"
Reexported modules
module Data.Rewriting.Term.Type
module Data.Rewriting.Term.Ops
module Data.Rewriting.Term.Pretty
module Data.Rewriting.Term.Parse