fourmolu-0.15.0.0: A formatter for Haskell source code

Safe Haskell | None
Language | GHC2021

Ormolu.Printer

Description

Pretty-printer for Haskell AST.

Synopsis

- printSnippets :: Bool -> [SourceSnippet] -> PrinterOptsTotal -> Text
- data PrinterOpts (f :: Type -> Type) = PrinterOpts {
  - poIndentation :: f Int
  - poColumnLimit :: f ColumnLimit
  - poFunctionArrows :: f FunctionArrowsStyle
  - poCommaStyle :: f CommaStyle
  - poImportExportStyle :: f ImportExportStyle
  - poIndentWheres :: f Bool
  - poRecordBraceSpace :: f Bool
  - poNewlinesBetweenDecls :: f Int
  - poHaddockStyle :: f HaddockPrintStyle
  - poHaddockStyleModule :: f HaddockPrintStyleModule
  - poLetStyle :: f LetStyle
  - poInStyle :: f InStyle
  - poSingleConstraintParens :: f SingleConstraintParens
  - poSingleDerivingParens :: f SingleDerivingParens
  - poUnicode :: f Unicode
  - poRespectful :: f Bool
  }

# Documentation

printSnippets #

Arguments

:: Bool | Whether to print out debug information during printing
-> [SourceSnippet] | Result of parsing
-> PrinterOptsTotal |
-> Text | Resulting rendition

Render several source snippets.

data PrinterOpts (f :: Type -> Type) #

Options controlling formatting output.

Constructors

PrinterOpts |

Fields

- poIndentation :: f Int

  Number of spaces per indentation step

- poColumnLimit :: f ColumnLimit

  Max line length for automatic line breaking

- poFunctionArrows :: f FunctionArrowsStyle

  Styling of arrows in type signatures

- poCommaStyle :: f CommaStyle

  How to place commas in multi-line lists, records, etc.

- poImportExportStyle :: f ImportExportStyle

  Styling of import/export lists

- poIndentWheres :: f Bool

  Whether to full-indent or half-indent 'where' bindings past the preceding body

- poRecordBraceSpace :: f Bool

  Whether to leave a space before an opening record brace

- poNewlinesBetweenDecls :: f Int

  Number of spaces between top-level declarations

- poHaddockStyle :: f HaddockPrintStyle

  How to print Haddock comments

- poHaddockStyleModule :: f HaddockPrintStyleModule

  How to print module docstring

- poLetStyle :: f LetStyle

  Styling of let blocks

- poInStyle :: f InStyle

  How to align the 'in' keyword with respect to the 'let' keyword

- poSingleConstraintParens :: f SingleConstraintParens

  Whether to put parentheses around a single constraint

- poSingleDerivingParens :: f SingleDerivingParens

  Whether to put parentheses around a single deriving class

- poUnicode :: f Unicode

  Output Unicode syntax

- poRespectful :: f Bool

  Give the programmer more choice on where to insert blank lines

#### Instances

Instances details

FromJSON PrinterOptsPartial # |
Instance details Defined in Ormolu.Config Methods parseJSON :: Value -> Parser PrinterOptsPartial # parseJSONList :: Value -> Parser [PrinterOptsPartial] # omittedField :: Maybe PrinterOptsPartial #
Monoid PrinterOptsPartial # |
Instance details Defined in Ormolu.Config Methods mempty :: PrinterOptsPartial # mappend :: PrinterOptsPartial -> PrinterOptsPartial -> PrinterOptsPartial # mconcat :: [PrinterOptsPartial] -> PrinterOptsPartial #
Semigroup PrinterOptsPartial # |
Instance details Defined in Ormolu.Config Methods (<>) :: PrinterOptsPartial -> PrinterOptsPartial -> PrinterOptsPartial # sconcat :: NonEmpty PrinterOptsPartial -> PrinterOptsPartial # stimes :: Integral b => b -> PrinterOptsPartial -> PrinterOptsPartial #
Show PrinterOptsPartial # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> PrinterOptsPartial -> ShowS # show :: PrinterOptsPartial -> String # showList :: [PrinterOptsPartial] -> ShowS #
Show PrinterOptsTotal # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> PrinterOptsTotal -> ShowS # show :: PrinterOptsTotal -> String # showList :: [PrinterOptsTotal] -> ShowS #
Eq PrinterOptsPartial # |
Instance details Defined in Ormolu.Config Methods (==) :: PrinterOptsPartial -> PrinterOptsPartial -> Bool # (/=) :: PrinterOptsPartial -> PrinterOptsPartial -> Bool #
Eq PrinterOptsTotal # |
Instance details Defined in Ormolu.Config Methods (==) :: PrinterOptsTotal -> PrinterOptsTotal -> Bool # (/=) :: PrinterOptsTotal -> PrinterOptsTotal -> Bool #
Generic (PrinterOpts f) # |

Instance details

Defined in Ormolu.Config.Gen

Associated Types

type Rep (PrinterOpts f) |
Instance details Defined in Ormolu.Config.Gen type Rep (PrinterOpts f)

Methods

from :: PrinterOpts f -> Rep (PrinterOpts f) x #

to :: Rep (PrinterOpts f) x -> PrinterOpts f #

type Rep (PrinterOpts f) # |
Instance details Defined in Ormolu.Config.Gen type Rep (PrinterOpts f)