summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2018-10-15 13:36:16 -0400
committerBen Gamari <ben@smart-cactus.org>2018-10-15 17:41:48 -0400
commit846fe90464a1916df4ea72659255963a596eec84 (patch)
tree4068367730bcd359b51eb94fd982d3d89041d552 /libraries/base
parenta816ac48b01bfc2419c11c9f2ef999e9bda7e95f (diff)
downloadhaskell-846fe90464a1916df4ea72659255963a596eec84.tar.gz
Typeable: Only render saturated tuple types with tuple syntax
This isn't as efficient as it could be since it needs to compute the kind of the type. However, this is `show` so there shouldn't be any particular expectation of speed. Fixes #14341. Test Plan: Validate Reviewers: hvr Subscribers: monoidal, rwbarton, carter GHC Trac Issues: #14341 Differential Revision: https://phabricator.haskell.org/D5080
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/Data/Typeable/Internal.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 0d4fc825cf..06d225adb7 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -773,7 +773,11 @@ showTypeable _ TrType = showChar '*'
showTypeable _ rep
| isListTyCon tc, [ty] <- tys =
showChar '[' . shows ty . showChar ']'
- | isTupleTyCon tc =
+
+ -- Take care only to render saturated tuple tycon applications
+ -- with tuple notation (#14341).
+ | isTupleTyCon tc,
+ Just _ <- TrType `eqTypeRep` typeRepKind rep =
showChar '(' . showArgs (showChar ',') tys . showChar ')'
where (tc, tys) = splitApps rep
showTypeable _ (TrTyCon {trTyCon = tycon, trKindVars = []})