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.ConstantPropagation

Description

 
Synopsis

Documentation

run :: MonadError Error m => Program -> m Program Source #

run does constant propagation. This assumes that the program is alpha-converted.

For example, this converts the following:

let x = 1
in let f = fun y -> y
in x + x + f(x)

to:

let f = fun y -> y
in 1 + 1 + f(1)

NOTE: this doesn't constant folding.