From e546aeee4ad0e2058250440e9a199665f84b5959 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 3 May 2007 12:50:06 +0000 Subject: [PATCH] use the reader part of the monad for the inScope set --- compiler/deSugar/Coverage.lhs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler/deSugar/Coverage.lhs b/compiler/deSugar/Coverage.lhs index e56f231..a011df6 100644 --- a/compiler/deSugar/Coverage.lhs +++ b/compiler/deSugar/Coverage.lhs @@ -70,11 +70,11 @@ addCoverageTicksToBinds dflags mod mod_loc binds = do (TTE { modName = mod_name , declPath = [] + , inScope = emptyVarSet }) (TT { tickBoxCount = 0 , mixEntries = [] - , inScope = emptyVarSet }) let entries = reverse $ mixEntries st @@ -513,11 +513,11 @@ addTickArithSeqInfo (FromThenTo e1 e2 e3) = \begin{code} data TickTransState = TT { tickBoxCount:: Int , mixEntries :: [MixEntry] - , inScope :: VarSet -- move the TickTransEnv } data TickTransEnv = TTE { modName :: String , declPath :: [String] + , inScope :: VarSet } -- deriving Show @@ -556,11 +556,6 @@ getState = TM $ \ env st -> (st, noFVs, st) setState :: (TickTransState -> TickTransState) -> TM () setState f = TM $ \ env st -> ((), noFVs, f st) -withState :: (TickTransState -> TickTransState) -> TM a -> TM a -withState f (TM m) = TM $ \ env st -> - case m env (f st) of - (a, fvs, st') -> (a, fvs, st') - getEnv :: TM TickTransEnv getEnv = TM $ \ env st -> (env, noFVs, st) @@ -575,7 +570,7 @@ getFreeVars (TM m) freeVar :: Id -> TM () freeVar id = TM $ \ env st -> - if id `elemVarSet` inScope st + if id `elemVarSet` inScope env then ((), unitOccEnv (nameOccName (idName id)) id, st) else ((), noFVs, st) @@ -588,7 +583,7 @@ getPathEntry = declPath `liftM` getEnv bindLocals :: [Id] -> TM a -> TM a bindLocals new_ids (TM m) = TM $ \ env st -> - case m env st{ inScope = inScope st `extendVarSetList` new_ids } of + case m env{ inScope = inScope env `extendVarSetList` new_ids } st of (r, fv, st') -> (r, fv `delListFromUFM` occs, st') where occs = [ nameOccName (idName id) | id <- new_ids ] -- 1.7.10.4