Ormolu.Printer

fourmolu-0.17.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 #

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