Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming
Copyright(c) Kimiyuki Onaka 2021
LicenseApache License 2.0
Maintainerkimiyuki95@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Jikka.Core.Convert.TrivialLetElimination

Description

 
Synopsis

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.