Changed the passes to be of type Pass, rather than A.Process -> PassM A.Process

This commit is contained in:
Neil Brown 2007-10-17 13:09:16 +00:00
parent 30b7cc686b
commit a25824b601
6 changed files with 9 additions and 13 deletions

View File

@ -42,7 +42,7 @@ instance Die PassM where
type Pass = A.Process -> PassM A.Process type Pass = A.Process -> PassM A.Process
-- | Compose a list of passes into a single pass. -- | Compose a list of passes into a single pass.
runPasses :: [(String, Pass)] -> A.Process -> PassM A.Process runPasses :: [(String, Pass)] -> Pass
runPasses [] ast = return ast runPasses [] ast = return ast
runPasses ((s, p):ps) ast runPasses ((s, p):ps) ast
= do debug $ "{{{ " ++ s = do debug $ "{{{ " ++ s
@ -83,7 +83,7 @@ veryDebug :: (CSM m, MonadIO m) => String -> m ()
veryDebug = verboseMessage 3 veryDebug = verboseMessage 3
-- | Dump the AST and parse state. -- | Dump the AST and parse state.
debugAST :: (CSM m, MonadIO m) => A.Process -> m () debugAST :: (CSM m, MonadIO m, Data t) => t -> m ()
debugAST p debugAST p
= do veryDebug $ "{{{ AST" = do veryDebug $ "{{{ AST"
veryDebug $ pshow p veryDebug $ pshow p

View File

@ -29,7 +29,7 @@ import Metadata
import Types import Types
import Pass import Pass
simplifyComms :: A.Process -> PassM A.Process simplifyComms :: Pass
simplifyComms = runPasses passes simplifyComms = runPasses passes
where where
passes = passes =

View File

@ -30,7 +30,7 @@ import Metadata
import Pass import Pass
import Types import Types
simplifyExprs :: A.Process -> PassM A.Process simplifyExprs :: Pass
simplifyExprs = runPasses passes simplifyExprs = runPasses passes
where where
passes = passes =

View File

@ -28,7 +28,7 @@ import Metadata
import Types import Types
import Pass import Pass
simplifyProcs :: A.Process -> PassM A.Process simplifyProcs :: Pass
simplifyProcs = runPasses passes simplifyProcs = runPasses passes
where where
passes = passes =

View File

@ -26,7 +26,7 @@ import qualified AST as A
import Pass import Pass
import Types import Types
simplifyTypes :: A.Process -> PassM A.Process simplifyTypes :: Pass
simplifyTypes = runPasses passes simplifyTypes = runPasses passes
where where
passes = passes =
@ -46,10 +46,6 @@ resolveNamedTypes = doGeneric `extM` doType
doType t = doGeneric t doType t = doGeneric t
-- | Resolve named types in CompState. -- | Resolve named types in CompState.
rntState :: A.Process -> PassM A.Process rntState :: Data t => t -> PassM t
rntState p rntState p = (get >>= resolveNamedTypes >>= put) >> return p
= do st <- get
st' <- resolveNamedTypes st
put st'
return p

View File

@ -32,7 +32,7 @@ import Metadata
import Pass import Pass
import Types import Types
unnest :: A.Process -> PassM A.Process unnest :: Pass
unnest = runPasses passes unnest = runPasses passes
where where
passes = passes =