|
definition: |
unApply :: [Rule] -> [Rule]
unApply = map unApplyInRule . filter (not . applyRule)
where
-- does the rule defines the generated apply operation?
applyRule (Rule f _ _) = f == "apply"
unApplyInRule :: Rule -> Rule
unApplyInRule (Rule f args exp) = Rule f args (unApplyInExp exp)
unApplyInExp :: Term -> Term
unApplyInExp (Var i) = Var i
unApplyInExp (Func Cons c args) = Func Cons c (map unApplyInExp args)
unApplyInExp (Func Def f args) =
if f=="apply" && length args == 2
then Func Def "$" args
else Func Def f (map unApplyInExp args)
|
|
demand: |
no demanded arguments |
|
deterministic: |
deterministic operation |
|
documentation: |
-------------------------------------------------------------------- Remove all occurrences of generated apply operation in a program |
|
failfree: |
() |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{() |-> {.._#lambda508}}
|
|
name: |
unApply |
|
precedence: |
no precedence defined |
|
result-values: |
{.._#lambda508}
|
|
signature: |
[TRS.Rule] -> [TRS.Rule] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
reducible on all ground data terms |