HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduleprettyprinter-1.7.2Haskell2010

Prettyprinter.Render.Text

Render an unannotated SimpleDocStream as plain Text.

Contents
  1. Conversion to plain Text
  2. Render to a Handle
  3. Convenience functions
Synopsis

Conversion to plain Text

(renderLazy sdoc) takes the output sdoc from a rendering function and transforms it to lazy text.

Example3 expressions
let render = TL.putStrLn . renderLazy . layoutPretty defaultLayoutOptionslet doc = "lorem" <+> align (vsep ["ipsum dolor", parens "foo bar", "sit amet"])render doclorem ipsum dolor      (foo bar)      sit amet

Render to a Handle

valuerenderIO :: Handle -> SimpleDocStream ann -> IO ()

(renderIO h sdoc) writes sdoc to the file h.

Example1 expression
renderIO System.IO.stdout (layoutPretty defaultLayoutOptions "hello\nworld")helloworld

This function is more efficient than hPutStr h (renderStrict sdoc), since it writes to the handle directly, skipping the intermediate Text representation.

Convenience functions