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

Moduledistribution-nixpkgs-1.7.1.1Haskell2010

Language.Nix.PrettyPrinting

Internal pretty-printing helpers for Nix expressions.

Contents
  1. Re-exports from other modules
Synopsis

Re-exports from other modules

valuestyle :: Style

The default style (mode=PageMode, lineLength=100, ribbonsPerLine=1.5).

value($$) :: Doc -> Doc -> Doc

Above, except that if the last line of the first argument stops at least one position before the first line of the second begins, these two lines are overlapped. For example:

   text "hi" $$ nest 5 (text "there")

lays out as

   hi   there

rather than

   hi
        there

$$ is associative, with identity empty, and also satisfies

  • (x $$ y) <> z = x $$ (y <> z), if y non-empty.

valuechar :: Char -> Doc

A document of height and width 1, containing a literal character.

valuefirst :: Doc -> Doc -> Doc

first returns its first argument if it is non-empty, otherwise its second.

valuefullRender
  1. :: Mode

    Rendering mode.

  2. -> Int

    Line length.

  3. -> Float

    Ribbons per line.

  4. -> (TextDetails -> a -> a)

    What to do with text.

  5. -> a

    What to do at the end.

  6. -> Doc

    The document.

  7. -> a

    Result.

The general rendering interface. Please refer to the Style and Mode types for a description of rendering mode, line length and ribbons.

valuetext :: String -> Doc

A document of height 1 containing a literal string. text satisfies the following laws:

The side condition on the last law is necessary because text "" has height 1, while empty has no height.

datadata Mode

Rendering mode.

Constructors

Instances4Eq, Show, Generic, Rep
datadata Style

A rendering style. Allows us to specify constraints to choose among the many different rendering options.

Constructors

  • Style
    • mode :: Mode

      The rendering mode.

    • lineLength :: Int

      Maximum length of a line, in characters.

    • ribbonsPerLine :: Float

      Ratio of line length to ribbon length. A ribbon refers to the characters on a line excluding indentation. So a lineLength of 100, with a ribbonsPerLine of 2.0 would only allow up to 50 characters of ribbon to be displayed on a line, while allowing it to be indented up to 50 characters.

Instances4Eq, Show, Generic, Rep
datadata TextDetails

A TextDetails represents a fragment of text that will be output at some point in a Doc.

Constructors

  • Chr !Char

    A single Char fragment

  • Str String

    A whole String fragment

  • PStr String

    Used to represent a Fast String fragment but now deprecated and identical to the Str constructor.

Instances5Eq, Show, Generic, NFData, Rep
newtypenewtype Doc

The abstract type of documents. A Doc represents a set of layouts. A Doc with no occurrences of Union or NoDoc represents just one layout.

Instances10Eq, Show, IsString, Generic, Semigroup, Monoid, …
classclass Pretty a where

Pretty printing class. The precedence level is used in a similar way as in the Show class. Minimal complete definition is either pPrintPrec or pPrint.

Methods

Instances24Pretty, …
newtypenewtype PrettyLevel

Level of detail in the pretty printed output. Level 0 is the least detail.

Constructors

Instances3Eq, Ord, Show
  • Eq PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass
  • Ord PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass
  • Show PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass