[commit: ghc] wip/prettyprinter: Fix errant newlines (54cb35b)

git at git.haskell.org git at git.haskell.org
Wed Aug 16 22:47:42 UTC 2017


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

On branch  : wip/prettyprinter
Link       : http://ghc.haskell.org/trac/ghc/changeset/54cb35b757b4aac6b74b4153db27c6ae1e4c6c05/ghc

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

commit 54cb35b757b4aac6b74b4153db27c6ae1e4c6c05
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Jun 24 12:40:35 2017 -0400

    Fix errant newlines


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

54cb35b757b4aac6b74b4153db27c6ae1e4c6c05
 compiler/utils/Pretty.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs
index 15b8c64..0f6ca4b 100644
--- a/compiler/utils/Pretty.hs
+++ b/compiler/utils/Pretty.hs
@@ -123,6 +123,7 @@ import GHC.Ptr  ( Ptr(..) )
 
 import qualified Data.Text as T
 import qualified Data.Text.Lazy as TL
+import qualified Data.Text.Lazy.IO as TL
 
 import Data.Text.Prettyprint.Doc
 -- PI = PrettyprinterInternal
@@ -1010,7 +1011,7 @@ printDoc :: Mode -> Int -> Handle -> Doc a -> IO ()
 printDoc mode cols hdl doc = printDoc_ mode cols hdl (doc <> hardline)
 
 printDoc_ :: Mode -> Int -> Handle -> Doc a -> IO ()
-printDoc_ mode pprCols hdl doc = renderIO hdl (layoutPretty (mkLayoutOptions mode pprCols) doc) where
+printDoc_ mode pprCols hdl doc = TL.hPutStr hdl (renderLazy $ layoutPretty (mkLayoutOptions mode pprCols) doc) where
   mkLayoutOptions :: Mode -> Int -> LayoutOptions
   -- Note that this should technically be 1.5 as per the old implementation.
   -- I have no idea why that is.



More information about the ghc-commits mailing list