summaryrefslogtreecommitdiff
path: root/compiler/Language/Haskell/Syntax.hs
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-05-17 16:06:52 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-03 14:11:31 -0400
commitf9f8099598fd169fa2f17305fc660e5c473f8836 (patch)
tree5acdb9a38b78dc17ffa0abb63d87555e214d98af /compiler/Language/Haskell/Syntax.hs
parent3a8970ac0c69335a1d229f9c9a71e6e333e99bfb (diff)
downloadhaskell-f9f8099598fd169fa2f17305fc660e5c473f8836.tar.gz
TTG: Move ImpExp client-independent bits to L.H.S.ImpExp
Move the GHC-independent definitions from GHC.Hs.ImpExp to Language.Haskell.Syntax.ImpExp with the required TTG extension fields such as to keep the AST independent from GHC. This is progress towards having the haskell-syntax package, as described in #21592 Bumps haddock submodule
Diffstat (limited to 'compiler/Language/Haskell/Syntax.hs')
-rw-r--r--compiler/Language/Haskell/Syntax.hs23
1 files changed, 8 insertions, 15 deletions
diff --git a/compiler/Language/Haskell/Syntax.hs b/compiler/Language/Haskell/Syntax.hs
index 143b682405..d5129cbb13 100644
--- a/compiler/Language/Haskell/Syntax.hs
+++ b/compiler/Language/Haskell/Syntax.hs
@@ -20,6 +20,7 @@ module Language.Haskell.Syntax (
module Language.Haskell.Syntax.Binds,
module Language.Haskell.Syntax.Decls,
module Language.Haskell.Syntax.Expr,
+ module Language.Haskell.Syntax.ImpExp,
module Language.Haskell.Syntax.Lit,
module Language.Haskell.Syntax.Pat,
module Language.Haskell.Syntax.Type,
@@ -30,16 +31,13 @@ module Language.Haskell.Syntax (
import Language.Haskell.Syntax.Decls
import Language.Haskell.Syntax.Binds
import Language.Haskell.Syntax.Expr
+import Language.Haskell.Syntax.ImpExp
import Language.Haskell.Syntax.Lit
import Language.Haskell.Syntax.Extension
import Language.Haskell.Syntax.Pat
import Language.Haskell.Syntax.Type
-import GHC.Data.FastString
-import GHC.Data.Maybe (Maybe)
-import GHC.Prelude (Show)
-import GHC.Parser.Annotation
-import GHC.Hs.ImpExp (LIE, LImportDecl)
+import Data.Maybe (Maybe)
{-
Note [Language.Haskell.Syntax.* Hierarchy]
@@ -62,9 +60,6 @@ For more details, see
https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow
-}
--- | A ModuleName is essentially a simple string, e.g. @Data.List@.
-newtype ModuleName = ModuleName FastString deriving Show
-
-- | Haskell Module
--
-- All we actually declare here is the top-level structure for a module.
@@ -79,12 +74,12 @@ data HsModule p
-- For details on above see Note [exact print annotations] in GHC.Parser.Annotation
HsModule {
- hsmodExt :: XModule p,
+ hsmodExt :: XCModule p,
-- ^ HsModule extension point
- hsmodName :: Maybe (LocatedA ModuleName),
+ hsmodName :: Maybe (XRec p ModuleName),
-- ^ @Nothing@: \"module X where\" is omitted (in which case the next
-- field is Nothing too)
- hsmodExports :: Maybe (LocatedL [LIE p]),
+ hsmodExports :: Maybe (XRec p [LIE p]),
-- ^ Export list
--
-- - @Nothing@: export list omitted, so export everything
@@ -99,10 +94,8 @@ data HsModule p
-- For details on above see Note [exact print annotations] in GHC.Parser.Annotation
hsmodImports :: [LImportDecl p],
- -- ^ 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 p]
-- ^ Type, class, value, and interface signature decls
}
- | XModule (XXModule p)
+ | XModule !(XXModule p)
+