summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-02-21 21:23:40 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-20 07:48:38 -0400
commit95275a5f25a2e70b71240d4756109180486af1b1 (patch)
treeeb4801bb0e00098b8b9d513479de4fbbd779ddac /compiler/GHC/Hs.hs
parentf940fd466a86c2f8e93237b36835797be3f3c898 (diff)
downloadhaskell-95275a5f25a2e70b71240d4756109180486af1b1.tar.gz
GHC Exactprint main commit
Metric Increase: T10370 parsing001 Updates haddock submodule
Diffstat (limited to 'compiler/GHC/Hs.hs')
-rw-r--r--compiler/GHC/Hs.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs
index 8508120d6c..95cf14a616 100644
--- a/compiler/GHC/Hs.hs
+++ b/compiler/GHC/Hs.hs
@@ -30,9 +30,10 @@ module GHC.Hs (
module GHC.Hs.Utils,
module GHC.Hs.Doc,
module GHC.Hs.Extension,
+ module GHC.Parser.Annotation,
Fixity,
- HsModule(..),
+ HsModule(..), AnnsModule(..),
HsParsedModule(..)
) where
@@ -46,6 +47,7 @@ import GHC.Hs.ImpExp
import GHC.Hs.Lit
import Language.Haskell.Syntax
import GHC.Hs.Extension
+import GHC.Parser.Annotation
import GHC.Hs.Pat
import GHC.Hs.Type
import GHC.Hs.Utils
@@ -53,7 +55,6 @@ import GHC.Hs.Doc
import GHC.Hs.Instances () -- For Data instances
-- others:
-import GHC.Parser.Annotation ( ApiAnns )
import GHC.Utils.Outputable
import GHC.Types.Fixity ( Fixity )
import GHC.Types.SrcLoc
@@ -68,13 +69,14 @@ import Data.Data hiding ( Fixity )
-- All we actually declare here is the top-level structure for a module.
data HsModule
= HsModule {
+ hsmodAnn :: ApiAnn' AnnsModule,
hsmodLayout :: LayoutInfo,
-- ^ Layout info for the module.
-- For incomplete modules (e.g. the output of parseHeader), it is NoLayoutInfo.
hsmodName :: Maybe (Located ModuleName),
-- ^ @Nothing@: \"module X where\" is omitted (in which case the next
-- field is Nothing too)
- hsmodExports :: Maybe (Located [LIE GhcPs]),
+ hsmodExports :: Maybe (LocatedL [LIE GhcPs]),
-- ^ Export list
--
-- - @Nothing@: export list omitted, so export everything
@@ -94,7 +96,7 @@ data HsModule
-- downstream.
hsmodDecls :: [LHsDecl GhcPs],
-- ^ Type, class, value, and interface signature decls
- hsmodDeprecMessage :: Maybe (Located WarningTxt),
+ hsmodDeprecMessage :: Maybe (LocatedP WarningTxt),
-- ^ reason\/explanation for warning/deprecation of this module
--
-- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnOpen'
@@ -122,13 +124,19 @@ data HsModule
deriving instance Data HsModule
+data AnnsModule
+ = AnnsModule {
+ am_main :: [AddApiAnn],
+ am_decls :: AnnList
+ } deriving (Data, Eq)
+
instance Outputable HsModule where
- ppr (HsModule _ Nothing _ imports decls _ mbDoc)
+ ppr (HsModule _ _ Nothing _ imports decls _ mbDoc)
= pp_mb mbDoc $$ pp_nonnull imports
$$ pp_nonnull decls
- ppr (HsModule _ (Just name) exports imports decls deprec mbDoc)
+ ppr (HsModule _ _ (Just name) exports imports decls deprec mbDoc)
= vcat [
pp_mb mbDoc,
case exports of