diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/basicTypes/OccName.hs | 23 |
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 |
