X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnEnv.lhs;fp=compiler%2Frename%2FRnEnv.lhs;h=69272801cd621dbe549ec236b939d976e48d645d;hb=54e73a90c275713c3804239fe61fbd5208cee60f;hp=a4e6ab8497bd1376079a87349ef969de4689acf9;hpb=6ddc8fd8b4952a23d1016dbad4263b89b63c5ae3;p=ghc-hetmet.git diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs index a4e6ab8..6927280 100644 --- a/compiler/rename/RnEnv.lhs +++ b/compiler/rename/RnEnv.lhs @@ -20,7 +20,7 @@ module RnEnv ( newLocalBndrRn, newLocalBndrsRn, newIPNameRn, bindLocalName, bindLocalNames, bindLocalNamesFV, MiniFixityEnv, emptyFsEnv, extendFsEnv, lookupFsEnv, - bindLocalNamesFV_WithFixities, + addLocalFixities, bindLocatedLocalsFV, bindLocatedLocalsRn, bindSigTyVarsFV, bindPatSigTyVars, bindPatSigTyVarsFV, bindTyVarsRn, extendTyVarEnvFVRn, @@ -651,22 +651,17 @@ type MiniFixityEnv = FastStringEnv (Located Fixity) -------------------------------- -- Used for nested fixity decls to bind names along with their fixities. -- the fixities are given as a UFM from an OccName's FastString to a fixity decl -bindLocalNamesFV_WithFixities :: [Name] - -> MiniFixityEnv - -> RnM (a, FreeVars) -> RnM (a, FreeVars) -bindLocalNamesFV_WithFixities names fixities thing_inside - = bindLocalNamesFV names $ - extendFixityEnv boundFixities $ - thing_inside + +addLocalFixities :: MiniFixityEnv -> [Name] -> RnM a -> RnM a +addLocalFixities mini_fix_env names thing_inside + = extendFixityEnv (mapCatMaybes find_fixity names) thing_inside where - -- find the names that have fixity decls - boundFixities = foldr - (\ name -> \ acc -> - -- check whether this name has a fixity decl - case lookupFsEnv fixities (occNameFS (nameOccName name)) of - Just (L _ fix) -> (name, FixItem (nameOccName name) fix) : acc - Nothing -> acc) [] names - -- bind the names; extend the fixity env; do the thing inside + find_fixity name + = case lookupFsEnv mini_fix_env (occNameFS occ) of + Just (L _ fix) -> Just (name, FixItem occ fix) + Nothing -> Nothing + where + occ = nameOccName name \end{code} --------------------------------