X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnEnv.lhs;fp=compiler%2Frename%2FRnEnv.lhs;h=c3b5592834f2ac5855cc1707fd281fa5b65ea0b7;hb=f1cc3eb980a634e62f2739a7a25387c902fa9d8a;hp=c6d50520426f3741a1e313cec8758b198d8fc962;hpb=0a5613f40b0e32cf59966e6b56b807cdbe80aa7b;p=ghc-hetmet.git diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs index c6d5052..c3b5592 100644 --- a/compiler/rename/RnEnv.lhs +++ b/compiler/rename/RnEnv.lhs @@ -26,8 +26,8 @@ module RnEnv ( bindTyVarsRn, extendTyVarEnvFVRn, checkDupRdrNames, checkDupAndShadowedRdrNames, - checkDupAndShadowedNames, - mapFvRn, mapFvRnCPS, + checkDupNames, checkDupAndShadowedNames, + addFvRn, mapFvRn, mapMaybeFvRn, mapFvRnCPS, warnUnusedMatches, warnUnusedModules, warnUnusedImports, warnUnusedTopBinds, warnUnusedLocalBinds, dataTcOccs, unknownNameErr, kindSigErr, perhapsForallMsg @@ -989,11 +989,19 @@ checkShadowedOccs (global_env,local_env) loc_occs \begin{code} -- A useful utility +addFvRn :: FreeVars -> RnM (thing, FreeVars) -> RnM (thing, FreeVars) +addFvRn fvs1 thing_inside = do { (res, fvs2) <- thing_inside + ; return (res, fvs1 `plusFV` fvs2) } + mapFvRn :: (a -> RnM (b, FreeVars)) -> [a] -> RnM ([b], FreeVars) mapFvRn f xs = do stuff <- mapM f xs case unzip stuff of (ys, fvs_s) -> return (ys, plusFVs fvs_s) +mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars) +mapMaybeFvRn _ Nothing = return (Nothing, emptyFVs) +mapMaybeFvRn f (Just x) = do { (y, fvs) <- f x; return (Just y, fvs) } + -- because some of the rename functions are CPSed: -- maps the function across the list from left to right; -- collects all the free vars into one set