summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-12-05 18:58:34 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-08 08:33:36 -0500
commit7658cdd47198512b699492688f51fc8682d194cd (patch)
tree90712444d737b5d892578619f4c2db485c9bc411 /libraries
parent9ec76f61c880539114314fc3e4f96a4694f38ebe (diff)
downloadhaskell-7658cdd47198512b699492688f51fc8682d194cd.tar.gz
Restore show (typeRep @[]) == "[]"
The Show instance for TypeRep [] has changed in 9.5 to output "List" because the name of the type constructor changed. This seems to be accidental and is inconsistent with TypeReps of saturated lists, which are printed as e.g. "[Int]". For now, I'm restoring the old behavior; in the future, maybe we should show TypeReps without puns (List, Tuple, Type).
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/Typeable/Internal.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 209324d585..51ee0f745e 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -836,6 +836,8 @@ instance Show (TypeRep (a :: k)) where
showTypeable :: Int -> TypeRep (a :: k) -> ShowS
showTypeable _ TrType = showChar '*'
showTypeable _ rep
+ | isListTyCon tc, [] <- tys =
+ showString "[]"
| isListTyCon tc, [ty] <- tys =
showChar '[' . shows ty . showChar ']'