[commit: ghc] wip/ttypeable: Fix up type printer (4daf937)

git at git.haskell.org git at git.haskell.org
Sun Jan 29 20:18:58 UTC 2017


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

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/4daf937fe4588d5bd689eab95ecdd49a768740c2/ghc

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

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

    Fix up type printer


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

4daf937fe4588d5bd689eab95ecdd49a768740c2
 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