definition: |
renameLetVars :: [((VarIndex, TypeExpr), TAExpr)] -> TAExpr -> TransStateM ([((VarIndex, TypeExpr), TAExpr)], TAExpr) renameLetVars bindings exp = do fv <- getFreshVarIndex let args = map (fst . fst) bindings minarg = minimum (0 : args) maxarg = maximum (0 : args) rnm i = if i `elem` args then i - minarg + fv else i nargs = map (\ ((v,t),_) -> (rnm v,t)) bindings setFreshVarIndex (fv + maxarg - minarg + 1) addVarTypes nargs return (map (\ ((v,t),be) -> ((rnm v,t), rnmAllVars rnm be)) bindings, rnmAllVars rnm exp) |
demand: |
no demanded arguments |
deterministic: |
deterministic operation |
documentation: |
-- Rename let-bound variables in a let expression. |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
name: |
renameLetVars |
precedence: |
no precedence defined |
result-values: |
_ |
signature: |
[((Prelude.Int, FlatCurry.Types.TypeExpr), FlatCurry.Annotated.Types.AExpr FlatCurry.Types.TypeExpr)] -> FlatCurry.Annotated.Types.AExpr FlatCurry.Types.TypeExpr -> Control.Monad.Trans.State.StateT TransState Prelude.IO ([((Prelude.Int, FlatCurry.Types.TypeExpr), FlatCurry.Annotated.Types.AExpr FlatCurry.Types.TypeExpr)], FlatCurry.Annotated.Types.AExpr FlatCurry.Types.TypeExpr) |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |