{-# LANGUAGE RecordWildCards #-}
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
import Ormolu.Processing.Postprocess (postprocess)
printModule ::
ParseResult ->
Text
printModule ParseResult {..} =
prLiteralPrefix <> region <> prLiteralSuffix
where
region =
postprocess prIndent $
runR
( p_hsModule
prStackHeader
prShebangs
prPragmas
prImportQualifiedPost
prParsedSource
)
(mkSpanStream prParsedSource)
prCommentStream
prAnns
prUseRecordDot