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

git at git.haskell.org git at git.haskell.org
Fri Jul 29 16:28:54 UTC 2016


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

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

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

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

    Fix up type printer


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

d5c09aa1e59db3044b8ef086f1db2a348c954ef4
 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