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

Safe HaskellNone

DDC.Core.Transform.Beta

Description

Beta-reduce applications of a explicit lambda abstractions to variables and values.

Synopsis

Documentation

data Config Source

Constructors

Config 

Fields

configBindRedexes :: Bool

If we find a lambda abstraction applied to a redex then let-bind the redex and substitute the new variable instead.

Instances

configZero :: ConfigSource

Empty beta configuration with all flags set to False.

data Info Source

A summary of what the beta reduction transform did.

Constructors

Info 

Fields

infoTypes :: Int

Number of type applications reduced.

infoWits :: Int

Number of witness applications reduced.

infoValues :: Int

Number of value applications reduced.

infoValuesLetted :: Int

Number of redexes let-bound.

infoValuesSkipped :: Int

Number of applications that we couldn't reduce.

betaReduceSource

Arguments

:: forall c a n . (Ord n, TransformUpMX (Writer Info) c) 
=> Profile n

Language profile.

-> Config

Beta transform config.

-> c a n

Thing to transform.

-> TransformResult (c a n) 

Beta-reduce applications of a explicit lambda abstractions to variables and values.

If the flag is set then if we find a lambda abstraction that is applied to a redex then let-bind the redex and substitute the new variable instead.