    -- | A type for result of parsing.
    module Ormolu.Parser.Result
      ( SourceSnippet (..),
        ParseResult (..),
      )
    where

    import Data.Text (Text)
    import GHC.Data.EnumSet (EnumSet)
    import GHC.Hs
    import GHC.LanguageExtensions.Type
    import Ormolu.Config (SourceType)
    import Ormolu.Fixity (ModuleFixityMap)
    import Ormolu.Parser.CommentStream
    import Ormolu.Parser.Pragma (Pragma)

    -- | Either a 'ParseResult', or a raw snippet.
    data SourceSnippet = RawSnippet Text | ParsedSnippet ParseResult

    -- | A collection of data that represents a parsed module in Ormolu.
    data ParseResult = ParseResult
      { -- | Parsed module or signature
        ParseResult -> HsModule GhcPs
    prParsedSource :: HsModule GhcPs,
        -- | Either regular module or signature file
        ParseResult -> SourceType
    prSourceType :: SourceType,
        -- | Stack header
        ParseResult -> Maybe LComment
    prStackHeader :: Maybe LComment,
        -- | Pragmas and the associated comments
        ParseResult -> [([LComment], Pragma)]
    prPragmas :: [([LComment], Pragma)],
        -- | Comment stream
        ParseResult -> CommentStream
    prCommentStream :: CommentStream,
        -- | Enabled extensions
        ParseResult -> EnumSet Extension
    prExtensions :: EnumSet Extension,
        -- | Fixity map for operators
        ParseResult -> ModuleFixityMap
    prModuleFixityMap :: ModuleFixityMap,
        -- | Indentation level, can be non-zero in case of region formatting
        ParseResult -> Int
    prIndent :: Int
      }