instance Show MyType where showsPrec _ = renderShowS . layoutPretty defaultLayoutOptions . pretty
>>> renderIO System.IO.stdout (layoutPretty defaultLayoutOptions "hello\nworld") hello worldThis function is more efficient than hPutStr h (renderStrict sdoc), since it writes to the handle directly, skipping the intermediate Text representation.
>>> let render = TL.putStrLn . renderLazy . layoutPretty defaultLayoutOptions >>> let doc = "lorem" <+> align (vsep ["ipsum dolor", parens "foo bar", "sit amet"]) >>> render doc lorem ipsum dolor (foo bar) sit amet
>>> let doc = "hello" <+> annotate () "world" <> "!" >>> let stdoc = treeForm (layoutPretty defaultLayoutOptions doc) >>> T.putStrLn (renderSimplyDecorated id (\() x -> ">>>" <> x <> "<<<") stdoc) hello >>>world<<<!
>>> let doc = "hello" <+> annotate () "world" <> "!" >>> let sdoc = layoutPretty defaultLayoutOptions doc >>> T.putStrLn (renderSimplyDecorated id (\() -> ">>>") (\() -> "<<<") sdoc) hello >>>world<<<!The monoid will be concatenated in a right associative fashion.