fourmolu-0.18.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
  - poImportGrouping :: f ImportGrouping
  - 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
  - poSortConstraints :: f Bool
  - poSortDerivedClasses :: f Bool
  - poSortDerivingClauses :: f Bool
  - poTrailingSectionOperators :: f Bool
  - poUnicode :: f Unicode
  - poRespectful :: f Bool
  }

# Documentation

printSnippets Source #

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) Source #

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

- poImportGrouping :: f ImportGrouping

  Rules for grouping import declarations

- 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

- poSortConstraints :: f Bool

  Whether to sort constraints

- poSortDerivedClasses :: f Bool

  Whether to sort derived classes

- poSortDerivingClauses :: f Bool

  Whether to sort deriving clauses

- poTrailingSectionOperators :: f Bool

  Whether to place section operators (those that are infixr 0, such as $) in trailing position, continuing the expression indented below

- 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 Source # |
Instance details Defined in Ormolu.Config Methods mempty :: PrinterOptsPartial Source # mappend :: PrinterOptsPartial -> PrinterOptsPartial -> PrinterOptsPartial Source # mconcat :: [PrinterOptsPartial] -> PrinterOptsPartial Source #
Semigroup PrinterOptsPartial Source # |
Instance details Defined in Ormolu.Config Methods (<>) :: PrinterOptsPartial -> PrinterOptsPartial -> PrinterOptsPartial Source # sconcat :: NonEmpty PrinterOptsPartial -> PrinterOptsPartial Source # stimes :: Integral b => b -> PrinterOptsPartial -> PrinterOptsPartial Source #
Show PrinterOptsPartial Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> PrinterOptsPartial -> ShowS Source # show :: PrinterOptsPartial -> String Source # showList :: [PrinterOptsPartial] -> ShowS Source #
Show PrinterOptsTotal Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> PrinterOptsTotal -> ShowS Source # show :: PrinterOptsTotal -> String Source # showList :: [PrinterOptsTotal] -> ShowS Source #
Eq PrinterOptsPartial Source # |
Instance details Defined in Ormolu.Config Methods (==) :: PrinterOptsPartial -> PrinterOptsPartial -> Bool Source # (/=) :: PrinterOptsPartial -> PrinterOptsPartial -> Bool Source #
Eq PrinterOptsTotal Source # |
Instance details Defined in Ormolu.Config Methods (==) :: PrinterOptsTotal -> PrinterOptsTotal -> Bool Source # (/=) :: PrinterOptsTotal -> PrinterOptsTotal -> Bool Source #
Generic (PrinterOpts f) Source # |

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 Source #

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

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