Community
Modules 28

Data.Text.Prettyprint.Doc.Internal.Type

Use \ Prettyprinter.Internal.Type\ instead.

module Prettyprinter.Internal.Type prettyprinter-1.7.2 · 1 declaration

data Doc ann

The abstract data type Doc ann represents pretty documents that have been annotated with data of type ann.

More specifically, a value of type Doc represents a non-empty set of possible layouts of a document. The layout functions select one of these possibilities, taking into account things like the width of the output document.

The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as

  • color information (e.g. when rendering to the terminal)

  • mouseover text (e.g. when rendering to rich HTML)

  • whether to show something or not (to allow simple or detailed versions)

The simplest way to display a Doc is via the Show class.

>>> putStrLn (show (vsep ["hello", "world"]))
hello
world

Fail :: Doc ann

Occurs when flattening a line. The layouter will reject this document, choosing a more suitable rendering.

Char :: Char -> Doc ann

Text :: Int -> Text -> Doc ann

FlatAlt :: (Doc ann) -> (Doc ann) -> Doc ann

Cat :: (Doc ann) -> (Doc ann) -> Doc ann

Nest :: Int -> (Doc ann) -> Doc ann

Union :: (Doc ann) -> (Doc ann) -> Doc ann

Column :: (Int -> Doc ann) -> Doc ann

Nesting :: (Int -> Doc ann) -> Doc ann

Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 21 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 19f659e0fd2a9606431ae6a3ec65f9ace725052e19ca6a9f9e9f2759e30fd129

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.