[commit: ghc] wip/ttypeable: Fix pretty-printer (fe5bcf6)

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


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

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

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

commit fe5bcf68d079f330e7781958385c6f6f2572bba2
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Mar 16 22:07:23 2016 +0100

    Fix pretty-printer


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

fe5bcf68d079f330e7781958385c6f6f2572bba2
 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 d879905..a2431ac 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -347,14 +347,18 @@ instance Show (TypeRep (a :: k)) where
       showChar '(' . showArgs (showChar ',') tys . showChar ')'
     where (tc, tys) = splitApps rep
   showsPrec p (TrTyCon _ tycon _) = showsPrec p tycon
-  showsPrec _ (TrApp _ (TrTyCon _ tycon _) x)
+  --showsPrec p (TRFun x r) =
+  --    showParen (p > 8) $
+  --    showsPrec 9 x . showString " -> " . showsPrec 8 r
+  showsPrec p (TrApp _ (TrApp _ (TrTyCon _ tycon _) x) r)
     | isArrowTyCon tycon =
-      shows x . showString " ->"
+      showParen (p > 8) $
+      showsPrec 9 x . showString " -> " . showsPrec p r
 
   showsPrec p (TrApp _ f x)
     | otherwise =
       showParen (p > 9) $
-      showsPrec p f .
+      showsPrec 8 f .
       space .
       showsPrec 9 x
     where



More information about the ghc-commits mailing list