ddc-core-simpl-0.3.2.1: Disciplined Disciple Compiler code transformations.

Safe HaskellNone

DDC.Core.Simplifier.Recipe

Contents

Description

Common simplifier recipes that combine multiple transforms.

Synopsis

Atomic recipies

idsimp :: Simplifier s a nSource

The identity simplifier returns the code unharmed.

anonymize :: Simplifier s a nSource

Rewrite named binders to anonymous debruijn binders.

snip :: Simplifier s a nSource

Introduce let-bindings for nested applications.

snipOver :: Simplifier s a nSource

Introduce let-bindings for nested applications.

flatten :: Simplifier s a nSource

Flatten nested let and case expressions.

beta :: Simplifier s a nSource

Perform beta reduction

betaLets :: Simplifier s a nSource

Perform beta reduction, introducing let-expressions for compound arguments.

prune :: Simplifier s a nSource

Remove unused, pure let bindings.

forward :: Simplifier s a nSource

Float single-use bindings forward into their use sites.

bubble :: Simplifier s a nSource

Float casts outwards.

elaborate :: Simplifier s a nSource

Elaborate possible Const and Distinct witnesses that aren't otherwise in the program.

Compound recipies

anormalizeSource

Arguments

:: (KindEnv n -> Namifier s n)

Make a namifier to create fresh level-1 names.

-> (TypeEnv n -> Namifier s n)

Make a namifier to create fresh level-0 names.

-> Simplifier s a n 

Conversion to administrative normal-form.

rewriteSimpSource

Arguments

:: Int

Maximum number of iterations.

-> NamedRewriteRules a n

Rewrite rules to apply.

-> Simplifier s a n 

Intersperse rewrites and beta reduction