|
definition: |
normalizeLet :: Expr -> Expr
normalizeLet exp = case exp of
Var _ -> exp
Lit _ -> exp
Comb ct qf es -> Comb ct qf (map normalizeLet es)
Let bs e -> foldr Let e (sortLetBindings bs)
Free vs e -> Free vs (normalizeLet e)
Or e1 e2 -> Or (normalizeLet e1) (normalizeLet e2)
Case ct be bs -> Case ct (normalizeLet be)
(map (\ (Branch p e) -> Branch p (normalizeLet e)) bs)
Typed e t -> Typed (normalizeLet e) t
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
Normalize all let expressions occurring in an expression
by transforming each let expression into a hierarchical let expression
according to the dependencies of the bindings.
For instance,
let { x = f y ; y = g z} in e
is transformed into
let { y = g z} in let { x = f y} in e
|
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({Var}) |-> {Var} || ({Lit}) |-> {Lit} || ({Comb}) |-> {Comb} || ({Let}) |-> _ || ({Free}) |-> {Free} || ({Or}) |-> {Or} || ({Case}) |-> {Case} || ({Typed}) |-> {Typed}}
|
|
name: |
normalizeLet |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
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 |