HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleprettyprinter-1.7.1Haskell2010

Prettyprinter.Render.Text

Render an unannotated SimpleDocStream as plain Text.

  • 5 values

Conversion to plain Text

2 declarations
valuerenderLazy :: SimpleDocStream ann -> 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

1 declaration
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