summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.hs
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-08-04 16:20:08 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-08-05 10:10:33 +0200
commitf951ffc6e4aa8fad1f5dcb6fd013340bf792f92d (patch)
tree15184bb03c35cd489a584789b20f3546a027c70c /compiler/utils/Outputable.hs
parent926e4288c5aabb75addcdc4cbdc106e74c11162d (diff)
downloadhaskell-f951ffc6e4aa8fad1f5dcb6fd013340bf792f92d.tar.gz
Pretty: mimic pretty API more closely (#10735)
Refactoring only. Nothing much to see here.
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r--compiler/utils/Outputable.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index 5fa050ee71..948ae7d5df 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -434,21 +434,24 @@ showSDocDebug dflags d = renderWithStyle dflags d PprDebug
renderWithStyle :: DynFlags -> SDoc -> PprStyle -> String
renderWithStyle dflags sdoc sty
- = Pretty.showDoc PageMode (pprCols dflags) $
- runSDoc sdoc (initSDocContext dflags sty)
+ = let s = Pretty.style{ Pretty.mode = PageMode,
+ Pretty.lineLength = pprCols dflags }
+ in Pretty.renderStyle s $ runSDoc sdoc (initSDocContext dflags sty)
-- This shows an SDoc, but on one line only. It's cheaper than a full
-- showSDoc, designed for when we're getting results like "Foo.bar"
-- and "foo{uniq strictness}" so we don't want fancy layout anyway.
showSDocOneLine :: DynFlags -> SDoc -> String
showSDocOneLine dflags d
- = Pretty.showDoc OneLineMode (pprCols dflags) $
- runSDoc d (initSDocContext dflags defaultUserStyle)
+ = let s = Pretty.style{ Pretty.mode = OneLineMode,
+ Pretty.lineLength = pprCols dflags } in
+ Pretty.renderStyle s $ runSDoc d (initSDocContext dflags defaultUserStyle)
showSDocDumpOneLine :: DynFlags -> SDoc -> String
showSDocDumpOneLine dflags d
- = Pretty.showDoc OneLineMode irrelevantNCols $
- runSDoc d (initSDocContext dflags defaultDumpStyle)
+ = let s = Pretty.style{ Pretty.mode = OneLineMode,
+ Pretty.lineLength = irrelevantNCols } in
+ Pretty.renderStyle s $ runSDoc d (initSDocContext dflags defaultDumpStyle)
irrelevantNCols :: Int
-- Used for OneLineMode and LeftMode when number of cols isn't used