summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs.hs
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-01-06 14:02:47 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-07 13:14:57 -0500
commitb69a3460d11cba49e861f708100801c8e25efa3e (patch)
treea075a807851b803a62d602dab40b62472d2be297 /compiler/GHC/Hs.hs
parent1ca9adbc88903afe49de0d063ccd35daf43f7d9e (diff)
downloadhaskell-b69a3460d11cba49e861f708100801c8e25efa3e.tar.gz
Monomorphize HsModule to GhcPs (#17642)
Analyzing the call sites for `HsModule` reveals that it is only ever used with parsed code (i.e., `GhcPs`). This simplifies `HsModule` by concretizing its `pass` parameter to always be `GhcPs`. Fixes #17642.
Diffstat (limited to 'compiler/GHC/Hs.hs')
-rw-r--r--compiler/GHC/Hs.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs
index 103539a41b..ecd891b52e 100644
--- a/compiler/GHC/Hs.hs
+++ b/compiler/GHC/Hs.hs
@@ -63,12 +63,12 @@ import Data.Data hiding ( Fixity )
-- | Haskell Module
--
-- All we actually declare here is the top-level structure for a module.
-data HsModule pass
+data HsModule
= HsModule {
hsmodName :: Maybe (Located ModuleName),
-- ^ @Nothing@: \"module X where\" is omitted (in which case the next
-- field is Nothing too)
- hsmodExports :: Maybe (Located [LIE pass]),
+ hsmodExports :: Maybe (Located [LIE GhcPs]),
-- ^ Export list
--
-- - @Nothing@: export list omitted, so export everything
@@ -82,11 +82,11 @@ data HsModule pass
-- ,'ApiAnnotation.AnnClose'
-- For details on above see note [Api annotations] in ApiAnnotation
- hsmodImports :: [LImportDecl pass],
+ hsmodImports :: [LImportDecl GhcPs],
-- ^ We snaffle interesting stuff out of the imported interfaces early
-- on, adding that info to TyDecls/etc; so this list is often empty,
-- downstream.
- hsmodDecls :: [LHsDecl pass],
+ hsmodDecls :: [LHsDecl GhcPs],
-- ^ Type, class, value, and interface signature decls
hsmodDeprecMessage :: Maybe (Located WarningTxt),
-- ^ reason\/explanation for warning/deprecation of this module
@@ -113,12 +113,10 @@ data HsModule pass
-- hsmodImports,hsmodDecls if this style is used.
-- For details on above see note [Api annotations] in ApiAnnotation
--- deriving instance (DataIdLR name name) => Data (HsModule name)
-deriving instance Data (HsModule GhcPs)
-deriving instance Data (HsModule GhcRn)
-deriving instance Data (HsModule GhcTc)
-instance (OutputableBndrId p) => Outputable (HsModule (GhcPass p)) where
+deriving instance Data HsModule
+
+instance Outputable HsModule where
ppr (HsModule Nothing _ imports decls _ mbDoc)
= pp_mb mbDoc $$ pp_nonnull imports