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

Safe HaskellNone
LanguageHaskell98

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 :: Config Source #

Empty beta configuration with all flags set to False.

data Info Source #

A summary of what the beta reduction transform did.

Constructors

Info 

Fields

Instances

Monoid Info Source # 

Methods

mempty :: Info #

mappend :: Info -> Info -> Info #

mconcat :: [Info] -> Info #

Pretty Info Source # 

Associated Types

data PrettyMode Info :: * #

Methods

pprDefaultMode :: PrettyMode Info #

ppr :: Info -> Doc #

pprPrec :: Int -> Info -> Doc #

pprModePrec :: PrettyMode Info -> Int -> Info -> Doc #

betaReduce Source #

Arguments

:: forall (c :: * -> * -> *). (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.