|
definition: |
renameAllVars :: [(Int,Int)] -> Expr -> Expr
renameAllVars rnm = rnmE
where
rnmE exp = case exp of
Var v -> Var (rnmV v)
Lit _ -> exp
Comb ct qf es -> Comb ct qf (map rnmE es)
Or e1 e2 -> Or (rnmE e1) (rnmE e2)
Free vs e -> Free (map rnmV vs) (rnmE e)
Let vbs e -> Let (map (\(v,ve) -> (rnmV v, rnmE ve)) vbs) (rnmE e)
Case ct e brs -> Case ct (rnmE e)
(map (\(Branch p pe) -> Branch (rnmP p) (rnmE pe)) brs)
Typed e t -> Typed (rnmE e) t
rnmV v = maybe v id (lookup v rnm)
rnmP pat@(LPattern _) = pat
rnmP (Pattern qc vs) = Pattern qc (map rnmV vs)
|
|
demand: |
no demanded arguments |
|
deterministic: |
deterministic operation |
|
documentation: |
Replace all variables (even bound variables) in a FlatCurry expression by new variables. Thus, the result is a renamed variant of the input. |
|
failfree: |
_ |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_) |-> {renameAllVars.rnmE.20}}
|
|
name: |
renameAllVars |
|
precedence: |
no precedence defined |
|
result-values: |
{renameAllVars.rnmE.20}
|
|
signature: |
[(Prelude.Int, Prelude.Int)] -> FlatCurry.Types.Expr -> FlatCurry.Types.Expr |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |