 Yicho: A Combinator Library for Program Transformation  Contents  Index 

Yicho  Portability  portable  Stability  experimental  Maintainer  yokoyama@ipl.t.utokyo.ac.jp 





Description 
Yicho: a combinator library for program transformation.
Yicho web site is http://www.ipl.t.utokyo.ac.jp/yicho/


Synopsis 




Type Declarations


type RuleY = ExpQ > ExpY 
rule


type ExpY = Y ExpQ 
an expression with the environment and failuire manipulation


Basic Combinators


(<==) 
:: ExpQ  Pattern
 > ExpQ  Term
 > Y ()   Match



(==>) 
:: ExpQ  Pattern
 > ExpQ  Expression to be replaced with
 > RuleY   Rule



caseM :: ExpQ > [RuleY] > ExpY 
Meta Case


class Choice a where 
 Methods  (<+) :: a > a > a  Deterministic Choice

  Instances  


Lifted Match and Lifted Rule


(<===) 
:: ExpQ  Pattern
 > ExpY  Lifted term
 > Y ()   Lifted Match



(===>) 
:: ExpQ  Pattern
 > ExpY  Lifted expression to be replaced with
 > RuleY   Lifted Rule



Derivative Combinators


try :: RuleY > RuleY 
try attempts to apply rule r, if possible. Otherwise, let it be.


Directives


using :: ExpY > (String, Q [Dec]) > ExpY 
Setting definitions together with its module name in Y monad


mkrules 
:: String  Module Name
 > Q [Dec]  Declarations
 > RuleY   Make rules from declarations



mkunfold 
:: String  Module Name
 > Q [Dec]  Declarations
 > RuleY   > RuleY  


Variable Generation


pvar :: String > Y ExpQ 
Generating a pattern variable
The following code changes the names each time it is called.
pvar = return . join . genvar . ($:)


pvars :: [String] > Y [ExpQ] 
Generating pattern variables


genPE :: String > Int > ([PatQ], [ExpQ]) 

Betareduce


betareduce :: Exp > Exp 

Lifting


liftY :: Q a > Y a 
ExpQ > ExpY : the inverse of runY


Manipulating Monads


runY :: Y (Q e) > Q e 
ExpY > ExpQ : the inverse of liftY


(@@) :: Monad m => (a > m b) > (t > m a) > t > m b 
Monad composition


ret :: ExpQ > ExpY 
Lift from ExpQ to ExpY with instanciating bound variables in environment and
unfolding definitions kept in Y monad


ret2 :: ExpQ > ExpY 
Lift from ExpQ to ExpY with instanciating bound variables in environment


Pretty Printer


prettyQ :: (Ppr a, Show a) => Q a > IO () 

prettyY :: (Ppr a, Show a) => Y (Q a) > IO () 

prettyExpY :: ExpY > IO () 

prettySubstY :: Y () > IO () 

prettyExpQ :: ExpQ > IO () 

putExpQ :: ExpQ > IO () 

putExpY :: ExpY > IO () 

Show


putQ :: Show a => Q a > IO () 

putY :: Show a => Y (Q a) > IO () 

Light Pretty Printer


Pretty printing functions ending L print out expressions without module names of variables


prettyQL :: (Ppr a, Show a) => Q a > IO () 

prettyYL :: (Ppr a, Show a) => Y (Q a) > IO () 

prettyExpYL :: ExpY > IO () 

Tracer


traceExpQ :: ExpQ > ExpY 

traceExpY :: ExpY > ExpY 

traceExpQL :: ExpQ > ExpY 

traceExpYL :: ExpY > ExpY 

Produced by Haddock version 0.6 