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

git at git.haskell.org git at git.haskell.org
Mon Jun 6 11:12:34 UTC 2016


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

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

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

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

    Fix pretty-printer


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

ae746a31eca5baa7b42b378e4ff1c8049d445028
 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 dd66283..7a2e914 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -343,14 +343,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