[commit: ghc] wip/prettyprinter: Fix hang (3295971)

git at git.haskell.org git at git.haskell.org
Thu Jan 18 18:08:37 UTC 2018


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

On branch  : wip/prettyprinter
Link       : http://ghc.haskell.org/trac/ghc/changeset/32959719cbe6f9ca3dbbc02ab5f7002a37e4c57b/ghc

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

commit 32959719cbe6f9ca3dbbc02ab5f7002a37e4c57b
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Sep 13 17:01:48 2017 -0400

    Fix hang


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

32959719cbe6f9ca3dbbc02ab5f7002a37e4c57b
 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 e89a4ce..5eba739 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -706,9 +706,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 87c9fc9..ef6085d 100644
--- a/compiler/utils/Pretty.hs
+++ b/compiler/utils/Pretty.hs
@@ -394,7 +394,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