[commit: ghc] wip/ttypeable: Fix up type printer (317be40)

git at git.haskell.org git at git.haskell.org
Sat Oct 1 21:35:14 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/317be404cc1818c4a510c3eee20daf8770769ec0/ghc

>---------------------------------------------------------------

commit 317be404cc1818c4a510c3eee20daf8770769ec0
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Jul 10 10:51:56 2016 +0200

    Fix up type printer


>---------------------------------------------------------------

317be404cc1818c4a510c3eee20daf8770769ec0
 libraries/base/Data/Typeable/Internal.hs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 702616f..6e5242b 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -333,13 +333,17 @@ instance Show (TypeRep (a :: k)) where
     showsPrec = showTypeable
 
 showTypeable :: Int -> TypeRep (a :: k) -> ShowS
-showTypeable p rep =
+showTypeable p rep
+  | Just HRefl <- star `eqTypeRep` rep =
+    showTypeable' 9 rep
+
+  | otherwise =
     showParen (p > 9) $
-    showTypeable' 8 rep . showString " :: " . showTypeable' 8 (typeRepKind rep)
+    showTypeable' 9 rep . showString " :: " . showTypeable' 8 (typeRepKind rep)
 
 showTypeable' :: Int -> TypeRep (a :: k) -> ShowS
 showTypeable' _ rep
-  | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep *) =
+  | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) =
     showChar '*'
   | isListTyCon tc, [ty] <- tys =
     showChar '[' . shows ty . showChar ']'



More information about the ghc-commits mailing list