Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming

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.