PFE_Rewrite

Plain source file: pfe/PFE_Rewrite.hs (2005-07-20)

PFE_Rewrite is imported by: PFE4, PFE_Rewrites.

Sometimes we need to apply some rewrites before type checking, but we need to record what rewrite was applied so that cached results with different rewrites can be kept apart. Rewrites are therefore paired with names that uniquely identify them.

module PFE_Rewrite where
import MUtils

type RewriteName = String
data Rewrite m ds = Rewrite {rwName::RewriteName, rwFun::m (ds->ds)}

idRw = Rewrite "" (return id)
compRw (Rewrite n1 m1) (Rewrite n2 m2) = Rewrite (n1++n2) ((.) # m1 <# m2)
-- Note: composing with idRw doesn't change the name of the rewrite


Index

(HTML for this module was generated on 2006-08-12. About the conversion tool.)