summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-03-03 17:54:24 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-09 03:30:26 -0400
commit0bdb867e37bcfe4ae2c5c4f5f7e54b41acfe6116 (patch)
tree09a27fd75e23f5f7ad943534bd5b1c78ddb03adf
parent8a0997015df80fc9ae729dbbdb05c712e41929ca (diff)
downloadhaskell-0bdb867e37bcfe4ae2c5c4f5f7e54b41acfe6116.tar.gz
CoreTidy: handle special cases to preserve more sharing.
Metric Decrease: T16577
-rw-r--r--compiler/GHC/Core/TyCo/Tidy.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Core/TyCo/Tidy.hs b/compiler/GHC/Core/TyCo/Tidy.hs
index 47b90d356c..d25135af06 100644
--- a/compiler/GHC/Core/TyCo/Tidy.hs
+++ b/compiler/GHC/Core/TyCo/Tidy.hs
@@ -158,8 +158,9 @@ tidyTypes env tys = strictMap (tidyType env) tys
--
-- See Note [Strictness in tidyType and friends]
tidyType :: TidyEnv -> Type -> Type
-tidyType _ (LitTy n) = LitTy n
+tidyType _ t@(LitTy {}) = t -- Preserve sharing
tidyType env (TyVarTy tv) = TyVarTy $! tidyTyCoVarOcc env tv
+tidyType _ t@(TyConApp _ []) = t -- Preserve sharing if possible
tidyType env (TyConApp tycon tys) = TyConApp tycon $! tidyTypes env tys
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
tidyType env ty@(FunTy _ w arg res) = let { !w' = tidyType env w