[commit: ghc] master: Remove unused tidyOccNames and update Note (41d9a79)

git at git.haskell.org git at git.haskell.org
Sun Apr 30 09:26:30 UTC 2017


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

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

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

commit 41d9a79078b48b0e308be1fc61b9bd1b616c76c5
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sun Apr 30 09:29:49 2017 +0200

    Remove unused tidyOccNames and update Note
    
    addressing rwbarton’s concerns in
    https://phabricator.haskell.org/rGHC18ac80ff729e#66197
    
    Differential Revision: https://phabricator.haskell.org/D3511


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

41d9a79078b48b0e308be1fc61b9bd1b616c76c5
 compiler/basicTypes/OccName.hs | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs
index cde7cc5..f9c875e 100644
--- a/compiler/basicTypes/OccName.hs
+++ b/compiler/basicTypes/OccName.hs
@@ -99,8 +99,7 @@ module OccName (
 
         -- * Tidying up
         TidyOccEnv, emptyTidyOccEnv, initTidyOccEnv,
-        tidyOccName,
-        tidyOccNames, avoidClashesOccEnv,
+        tidyOccName, avoidClashesOccEnv,
 
         -- FsEnv
         FastStringEnv, emptyFsEnv, lookupFsEnv, extendFsEnv, mkFsEnv
@@ -117,7 +116,6 @@ import Outputable
 import Lexeme
 import Binary
 import Control.DeepSeq
-import Data.List (mapAccumL)
 import Data.Char
 import Data.Data
 
@@ -854,15 +852,13 @@ would like to see is
 
     (id,id,id) :: (a3 -> a3, a2 -> a2, a1 -> a1)
 
-This is achieved in tidyOccNames. It still uses tidyOccName to rename each name
-on its own, but it prepares the TidyEnv (using avoidClashesOccEnv), by “blocking” every
-name that occurs twice in the map. This way, none of the "a"s will get the
-priviledge of keeping this name, and all of them will get a suitable numbery by
-tidyOccName.
+To achieve this, the function avoidClashesOccEnv can be used to prepare the
+TidyEnv, by “blocking” every name that occurs twice in the map. This way, none
+of the "a"s will get the priviledge of keeping this name, and all of them will
+get a suitable number by tidyOccName.
 
-It may be inappropriate to use tidyOccNames if the caller needs access to the
-intermediate environments (e.g. to tidy the tyVarKind of a type variable). In that
-case, avoidClashesOccEnv should be used directly, and tidyOccName afterwards.
+This prepared TidyEnv can then be used with tidyOccName. See tidyTyCoVarBndrs
+for an example where this is used.
 
 This is #12382.
 
@@ -880,11 +876,6 @@ initTidyOccEnv = foldl add emptyUFM
     add env (OccName _ fs) = addToUFM env fs 1
 
 -- see Note [Tidying multiple names at once]
-tidyOccNames :: TidyOccEnv -> [OccName] -> (TidyOccEnv, [OccName])
-tidyOccNames env occs = mapAccumL tidyOccName env' occs
-  where
-    env' = avoidClashesOccEnv env occs
-
 avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
 avoidClashesOccEnv env occs = go env emptyUFM occs
   where



More information about the ghc-commits mailing list