Moduledistribution-nixpkgs-1.7.1.1Haskell2010
Language.Nix.PrettyPrinting
Internal pretty-printing helpers for Nix expressions.
- 5 types
- 1 class
- 66 values
- Packagedistribution-nixpkgs-1.7.1.1
- Exports72
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourcePrettyPrinting.hs
Re-exports from other modules
62 declarationsPretty 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
pPrintPrec :: PrettyLevel -> Rational -> a -> DocpPrint :: a -> DocpPrintList :: PrettyLevel -> [a] -> Doc
Instances24Pretty, …
Pretty LicenseDefined in distribution-nixpkgs-1.7.1.1 · Distribution.Nixpkgs.LicensePretty MetaDefined in distribution-nixpkgs-1.7.1.1 · Distribution.Nixpkgs.MetaPretty NixpkgsPlatformDefined in distribution-nixpkgs-1.7.1.1 · Distribution.Nixpkgs.MetaPretty IntegerDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty BoolDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty CharDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty FloatDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty IntDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty OrderingDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty BindingDefined in language-nix-2.2.0 · Language.Nix.BindingPretty IdentifierDefined in language-nix-2.2.0 · Language.Nix.IdentifierPretty PathDefined in language-nix-2.2.0 · Language.Nix.PathPretty ()Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty a => Pretty (Maybe a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassPretty a => Pretty [a]Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b) => Pretty (Either a b)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b) => Pretty (a, b)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) => Pretty (a, b, c, d, e, f, g, h)Defined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass
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, …
Eq DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJShow DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJShow DocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.PprLibIsString DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJGeneric DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJSemigroup DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJMonoid DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJNFData DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJPretty DocDefined in Cabal-syntax-3.12.1.0 · Distribution.Prettytype Rep Doc = D1 ('MetaDataDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJ"Doc"
"Text.PrettyPrint.HughesPJ"
"pretty-1.1.3.6-a72d"
'True) (C1 ('MetaCons"Doc"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ()))))
Nest (or indent) a document by a given number of positions (which may also be negative). nest satisfies the laws:
nest 0 x = xnest k (nest k' x) = nest (k+k') xnest k (x <> y) = nest k x <> nest k ynest k (x $$ y) = nest k x $$ nest k ynest k empty = empty
The side condition on the last law is needed because empty is a left identity for <>.
"Paragraph fill" version of sep.
A document of height and width 1, containing a literal character.
"Paragraph fill" version of cat.
A TextDetails represents a fragment of text that will be output at some
point in a Doc.
Instances5Eq, Show, Generic, NFData, Rep
Eq TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJNFData TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJtype Rep TextDetails = D1 ('MetaDataDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ"TextDetails"
"Text.PrettyPrint.Annotated.HughesPJ"
"pretty-1.1.3.6-a72d"
'False) (C1 ('MetaCons"Chr"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Char)) :+: (C1 ('MetaCons"Str"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons"PStr"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))
Rendering mode.
Constructors
PageModeNormal rendering (lineLength and ribbonsPerLine respected').
ZigZagModeWith zig-zag cuts.
LeftModeNo indentation, infinitely long lines (lineLength ignored), but explicit new lines, i.e.,
text "one" $$ text "two", are respected.OneLineModeAll on one line, lineLength ignored and explicit new lines (
$$) are turned into spaces.
Instances4Eq, Show, Generic, Rep
Eq ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJtype Rep Mode = D1 ('MetaDataDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ"Mode"
"Text.PrettyPrint.Annotated.HughesPJ"
"pretty-1.1.3.6-a72d"
'False) ((C1 ('MetaCons"PageMode"
'PrefixI 'False) U1 :+: C1 ('MetaCons"ZigZagMode"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"LeftMode"
'PrefixI 'False) U1 :+: C1 ('MetaCons"OneLineMode"
'PrefixI 'False) U1))
A rendering style. Allows us to specify constraints to choose among the many different rendering options.
Constructors
Stylemode :: ModeThe rendering mode.
lineLength :: IntMaximum length of a line, in characters.
ribbonsPerLine :: FloatRatio 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.0would 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
Eq StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJtype Rep Style = D1 ('MetaDataDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ"Style"
"Text.PrettyPrint.Annotated.HughesPJ"
"pretty-1.1.3.6-a72d"
'False) (C1 ('MetaCons"Style"
'PrefixI 'True) (S1 ('MetaSel ('Just"mode"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mode) :*: (S1 ('MetaSel ('Just"lineLength"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just"ribbonsPerLine"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float))))
The default style (mode=PageMode, lineLength=100, ribbonsPerLine=1.5).
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 thererather than
hi
therefirst returns its first argument if it is non-empty, otherwise its second.
fullRender :: ModeRendering mode.
-> IntLine length.
-> FloatRibbons per line.
-> (TextDetails -> a -> a)What to do with text.
-> aWhat to do at the end.
-> DocThe document.
-> aResult.
The general rendering interface. Please refer to the Style and Mode
types for a description of rendering mode, line length and ribbons.
hang d1 n d2 = sep [d1, nest n d2]List version of <>.
List version of <+>.
Returns True if the document is empty
Apply doubleQuotes to Doc if boolean is true.
Same as text. Used to be used for Bytestrings.
punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn]Perform some simplification of a built up GDoc.
Render the Doc to a String using the default Style (see style).
Render the Doc to a String using the given Style.
Some text with any width. (text s = sizedText (length s) s)
List version of $$.
Some text, but without any width. Use for non-printing text such as a HTML or Latex tags
Deprecated. Please use maybeParens instead
Parenthesize an value if the boolean is true.
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.HughesPJClassOrd PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassShow PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass
The "normal" (Level 0) of detail.
Pretty print a value with the prettyNormal level.