Skip to content

Commit

Permalink
Render LargeOutput to strict Text
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodigrim committed Apr 17, 2022
1 parent 328fdb6 commit 2ae35fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions prettyprinter/bench/LargeOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ randomProgram seed size = let MkGen gen = arbitrary in gen (mkQCGen seed) size
main :: IO ()
main = do
let prog = randomProgram 1 60
renderedProg = (renderLazy . layoutPretty defaultLayoutOptions { layoutPageWidth = Unbounded } . pretty) prog
(progLines, progWidth) = let l = TL.lines renderedProg in (length l, maximum (map TL.length l))
renderedProg = (renderStrict . layoutPretty defaultLayoutOptions { layoutPageWidth = Unbounded } . pretty) prog
(progLines, progWidth) = let l = T.lines renderedProg in (length l, maximum (map T.length l))
putDoc ("Program size:" <+> pretty progLines <+> "lines, maximum width:" <+> pretty progWidth)

let renderWith :: (Doc ann -> SimpleDocStream ann) -> Program -> TL.Text
renderWith f = renderLazy . f . pretty
let renderWith :: (Doc ann -> SimpleDocStream ann) -> Program -> T.Text
renderWith f = renderStrict . f . pretty

let _80ColumnsLayoutOptions = defaultLayoutOptions { layoutPageWidth = AvailablePerLine 80 0.5 }
unboundedLayoutOptions = defaultLayoutOptions { layoutPageWidth = Unbounded }
Expand Down

0 comments on commit 2ae35fb

Please sign in to comment.