summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2017-04-30 09:29:49 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2017-04-30 10:01:31 +0200
commit41d9a79078b48b0e308be1fc61b9bd1b616c76c5 (patch)
treecb8f9b8fafcfb5f37d86cc29f099c0a546ed0bb2 /compiler
parent945c45ad50ed31e3acb96fdaafb21640c4669f12 (diff)
downloadhaskell-41d9a79078b48b0e308be1fc61b9bd1b616c76c5.tar.gz
Remove unused tidyOccNames and update Note
addressing rwbarton’s concerns in https://phabricator.haskell.org/rGHC18ac80ff729e#66197 Differential Revision: https://phabricator.haskell.org/D3511
Diffstat (limited to 'compiler')
-rw-r--r--compiler/basicTypes/OccName.hs23
1 files changed, 7 insertions, 16 deletions
diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs
index cde7cc569b..f9c875e2f6 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