{-# LANGUAGE RecordWildCards #-}

-- | Pretty-printer for Haskell AST.
module Ormolu.Printer
  ( printModule,
  )
where

import Data.Text (Text)
import Ormolu.Parser.Result
import Ormolu.Printer.Combinators
import Ormolu.Printer.Meat.Module
import Ormolu.Printer.SpanStream

-- | Render a module.
printModule ::
  -- | Result of parsing
  ParseResult ->
  -- | Resulting rendition
  Text
printModule :: ParseResult -> Text
printModule ParseResult {..} =
  R () -> SpanStream -> CommentStream -> Anns -> Bool -> Text
runR
    ([Located String] -> [Pragma] -> ParsedSource -> R ()
p_hsModule [Located String]
prShebangs [Pragma]
prExtensions ParsedSource
prParsedSource)
    (ParsedSource -> SpanStream
forall a. Data a => a -> SpanStream
mkSpanStream ParsedSource
prParsedSource)
    CommentStream
prCommentStream
    Anns
prAnns
    Bool
prUseRecordDot