Safe Haskell  None 

 data Simplifier s a n
 = Trans (Transform s a n)
  Seq (Simplifier s a n) (Simplifier s a n)
  Fix Int (Simplifier s a n)
 data Transform s a n
 = Id
  Anonymize
  Snip Config
  Flatten
  Beta Config
  Eta Config
  Prune
  Forward
  Bubble
  Elaborate
  Inline {
 transInlineDef :: InlinerTemplates a n
  Rewrite {
 transRules :: NamedRewriteRules a n
  Namify {
 transMkNamifierT :: Env n > Namifier s n
 transMkNamifierX :: Env n > Namifier s n
 type InlinerTemplates a n = n > Maybe (Exp a n)
 type NamedRewriteRules a n = [(String, RewriteRule a n)]
 data TransformResult r = TransformResult {
 result :: r
 resultProgress :: Bool
 resultAgain :: Bool
 resultInfo :: TransformInfo
 data TransformInfo = forall i . (Typeable i, Pretty i) => TransformInfo i
 resultDone :: String > r > TransformResult r
 applySimplifier :: (Show a, Ord n, Show n, Pretty n, NFData a, NFData n) => Profile n > KindEnv n > TypeEnv n > Simplifier s a n > Module a n > State s (Module a n)
 applySimplifierX :: (Show a, Show n, Ord n, Pretty n) => Profile n > KindEnv n > TypeEnv n > Simplifier s a n > Exp a n > State s (TransformResult (Exp a n))
Simplifier Specifications
data Simplifier s a n Source
Specification of how to simplify a core program.
Trans (Transform s a n)  Apply a single transform. 
Seq (Simplifier s a n) (Simplifier s a n)  Apply two simplifiers in sequence. 
Fix Int (Simplifier s a n)  Keep applying a transform until it reports that further applications won't be helpful, bailing out after a maximum number of applications. 
Monoid (Simplifier s a n)  
Pretty (Simplifier s a n) 
Transform Specifications
Individual transforms to apply during simplification.
Id  The Identity transform returns the original program unharmed. 
Anonymize  Rewrite named binders to anonymous deBruijn binders. 
Snip Config  Introduce letbindings for nested applications. 
Flatten  Flatten nested let and case expressions. 
Beta Config  Perform beta reduction when the argument is not a redex. 
Eta Config  Perform eta expansion and reduction. 
Prune  Remove unused, pure let bindings. 
Forward  Float singleuse bindings forward into their use sites. 
Bubble  Float casts outwards. 
Elaborate  Elaborate possible Const and Distinct witnesses that aren't otherwise in the program. 
Inline  Inline definitions into their use sites. 
 
Rewrite  Apply general rulebased rewrites. 
 
Namify  Rewrite anonymous binders to fresh named binders. 

type InlinerTemplates a n = n > Maybe (Exp a n)Source
Function to get the inliner template (unfolding) for the given name.
type NamedRewriteRules a n = [(String, RewriteRule a n)]Source
Rewrite rules along with their names.
Transform Results
data TransformResult r Source
Package up the result of applying a single transform.
TransformResult  

data TransformInfo Source
Existential package for a typeable thing,
used in TransformResult
.
forall i . (Typeable i, Pretty i) => TransformInfo i 
resultDone :: String > r > TransformResult rSource
Create a default result with no transform again.
We'll say we made progress, but set resultAgain
to False
so to stop any simplifier fixpoints.
Application
:: (Show a, Ord n, Show n, Pretty n, NFData a, NFData n)  
=> Profile n  Profile of language we're working in 
> KindEnv n  Kind environment 
> TypeEnv n  Type environment 
> Simplifier s a n  Simplifier to apply 
> Module a n  Module to simplify 
> State s (Module a n) 
Apply a simplifier to a module.
The state monad can be used by Namifier
functions to generate fresh names.
:: (Show a, Show n, Ord n, Pretty n)  
=> Profile n  Profile of language we're working in 
> KindEnv n  Kind environment 
> TypeEnv n  Type environment 
> Simplifier s a n  Simplifier to apply 
> Exp a n  Expression to simplify 
> State s (TransformResult (Exp a n)) 
Apply a simplifier to an expression.
The state monad can be used by Namifier
functions to generate fresh names.