[commit: ghc] wip/prettyprinter: Fix errant newlines (31d8e71)
git at git.haskell.org
git at git.haskell.org
Thu Jan 18 18:08:26 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/prettyprinter
Link : http://ghc.haskell.org/trac/ghc/changeset/31d8e717dffb61e225ca61e8a6453b2db4171b5b/ghc
>---------------------------------------------------------------
commit 31d8e717dffb61e225ca61e8a6453b2db4171b5b
Author: Ben Gamari <ben at smart-cactus.org>
Date: Sat Jun 24 12:40:35 2017 -0400
Fix errant newlines
>---------------------------------------------------------------
31d8e717dffb61e225ca61e8a6453b2db4171b5b
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 bfc8bb2..a611b78 100644
--- a/compiler/utils/Pretty.hs
+++ b/compiler/utils/Pretty.hs
@@ -124,6 +124,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
@@ -1011,7 +1012,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