[commit: ghc] wip/prettyprinter: Fix hang (ab4481a)
git at git.haskell.org
git at git.haskell.org
Wed Sep 13 21:09:16 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/prettyprinter
Link : http://ghc.haskell.org/trac/ghc/changeset/ab4481a27e109480e764e7c83b9ee85ed2b4d217/ghc
>---------------------------------------------------------------
commit ab4481a27e109480e764e7c83b9ee85ed2b4d217
Author: Ben Gamari <ben at smart-cactus.org>
Date: Wed Sep 13 17:01:48 2017 -0400
Fix hang
>---------------------------------------------------------------
ab4481a27e109480e764e7c83b9ee85ed2b4d217
compiler/utils/Outputable.hs | 6 +++---
compiler/utils/Pretty.hs | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index 971a548..ae3dfb7 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -701,9 +701,9 @@ fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds]
fcat ds = SDoc $ \sty -> Pretty.fcat [runSDoc d sty | d <- ds]
hang :: SDoc -- ^ The header
- -> Int -- ^ Amount to indent the hung body
- -> SDoc -- ^ The hung body, indented and placed below the header
- -> SDoc
+ -> Int -- ^ Amount to indent the hung body
+ -> SDoc -- ^ The hung body, indented and placed below the header
+ -> SDoc
hang d1 n d2 = SDoc $ \sty -> Pretty.hang (runSDoc d1 sty) n (runSDoc d2 sty)
-- | This behaves like 'hang', but does not indent the second document
diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs
index 583fb21..a38df9d 100644
--- a/compiler/utils/Pretty.hs
+++ b/compiler/utils/Pretty.hs
@@ -392,7 +392,7 @@ isEmpty _ = False
-- | @hang d1 n d2 = sep [d1, nest n d2]@
hang :: Doc a -> Int -> Doc a -> Doc a
-hang d1 n d2 = sep [d1, nest n d2]
+hang d1 n d2 = nest n (sep [d1, d2])
More information about the ghc-commits
mailing list