[commit: ghc] master: Tidy up tidying (cbe30fd)

git at git.haskell.org git at git.haskell.org
Tue Jul 5 15:20:10 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cbe30fda6d7c32415583654c8dfbfb74b1bde999/ghc

>---------------------------------------------------------------

commit cbe30fda6d7c32415583654c8dfbfb74b1bde999
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jul 5 13:49:02 2016 +0100

    Tidy up tidying
    
    This is a tiny refactor, replacing an ad-hoc local function
    (TidyPgm.loookup_aux_id) with a solid global one (tidyVarOcc).


>---------------------------------------------------------------

cbe30fda6d7c32415583654c8dfbfb74b1bde999
 compiler/main/TidyPgm.hs | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index 915cd12..6ec1e02 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -350,7 +350,7 @@ tidyProgram hsc_env  (ModGuts { mg_module    = mod
                                     isExternalName (idName id)]
               ; type_env1  = extendTypeEnvWithIds type_env final_ids
 
-              ; tidy_cls_insts = map (tidyClsInstDFun (lookup_aux_id tidy_type_env)) cls_insts
+              ; tidy_cls_insts = map (tidyClsInstDFun (tidyVarOcc tidy_env)) cls_insts
                 -- A DFunId will have a binding in tidy_binds, and so will now be in
                 -- tidy_type_env, replete with IdInfo.  Its name will be unchanged since
                 -- it was born, but we want Global, IdInfo-rich (or not) DFunId in the
@@ -367,7 +367,7 @@ tidyProgram hsc_env  (ModGuts { mg_module    = mod
                 -- and then override the PatSyns in the type_env with the new tidy ones
                 -- This is really the only reason we keep mg_patsyns at all; otherwise
                 -- they could just stay in type_env
-              ; tidy_patsyns = map (tidyPatSynIds (lookup_aux_id tidy_type_env)) patsyns
+              ; tidy_patsyns = map (tidyPatSynIds (tidyVarOcc tidy_env)) patsyns
               ; type_env2    = extendTypeEnvWithPatSyns tidy_patsyns type_env1
 
               ; tidy_type_env = tidyTypeEnv omit_prags type_env2
@@ -429,12 +429,6 @@ tidyProgram hsc_env  (ModGuts { mg_module    = mod
   where
     dflags = hsc_dflags hsc_env
 
-lookup_aux_id :: TypeEnv -> Var -> Id
-lookup_aux_id type_env id
-  = case lookupTypeEnv type_env (idName id) of
-        Just (AnId id') -> id'
-        _other          -> pprPanic "lookup_aux_id" (ppr id)
-
 tidyTypeEnv :: Bool       -- Compiling without -O, so omit prags
             -> TypeEnv -> TypeEnv
 



More information about the ghc-commits mailing list