| Copyright | (c) Kimiyuki Onaka 2021 |
|---|---|
| License | Apache License 2.0 |
| Maintainer | kimiyuki95@gmail.com |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Jikka.Core.Convert.TrivialLetElimination
Description
Documentation
run :: MonadError Error m => Program -> m Program Source #
run remove let-exprs whose assigned variables are used only at most once.
This assumes that the program is alpha-converted.
For example, this converts the following:
let f = fun y -> y in let x = 1 in f(x + x)
to:
let x = 1 in (fun y -> y) (x + x)
NOTE: this doesn't constant folding.