diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-10-15 17:55:34 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-29 03:53:52 -0400 |
commit | 0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59 (patch) | |
tree | 1c9d9848db07596c19221fd195db81cdf6430385 /compiler/GHC/Hs | |
parent | 795908dc4eab8e8b40cb318a2adbe4a4d4126c74 (diff) | |
download | haskell-0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59.tar.gz |
Split GHC.Driver.Types
I was working on making DynFlags stateless (#17957), especially by
storing loaded plugins into HscEnv instead of DynFlags. It turned out to
be complicated because HscEnv is in GHC.Driver.Types but LoadedPlugin
isn't: it is in GHC.Driver.Plugins which depends on GHC.Driver.Types. I
didn't feel like introducing yet another hs-boot file to break the loop.
Additionally I remember that while we introduced the module hierarchy
(#13009) we talked about splitting GHC.Driver.Types because it contained
various unrelated types and functions, but we never executed. I didn't
feel like making GHC.Driver.Types bigger with more unrelated Plugins
related types, so finally I bit the bullet and split GHC.Driver.Types.
As a consequence this patch moves a lot of things. I've tried to put
them into appropriate modules but nothing is set in stone.
Several other things moved to avoid loops.
* Removed Binary instances from GHC.Utils.Binary for random compiler
things
* Moved Typeable Binary instances into GHC.Utils.Binary.Typeable: they
import a lot of things that users of GHC.Utils.Binary don't want to
depend on.
* put everything related to Units/Modules under GHC.Unit:
GHC.Unit.Finder, GHC.Unit.Module.{ModGuts,ModIface,Deps,etc.}
* Created several modules under GHC.Types: GHC.Types.Fixity, SourceText,
etc.
* Split GHC.Utils.Error (into GHC.Types.Error)
* Finally removed GHC.Driver.Types
Note that this patch doesn't put loaded plugins into HscEnv. It's left
for another patch.
Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Hs')
-rw-r--r-- | compiler/GHC/Hs/Binds.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Hs/Decls.hs | 9 | ||||
-rw-r--r-- | compiler/GHC/Hs/Dump.hs | 10 | ||||
-rw-r--r-- | compiler/GHC/Hs/Expr.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Hs/ImpExp.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Hs/Lit.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Hs/Pat.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Hs/Utils.hs | 6 |
9 files changed, 32 insertions, 21 deletions
diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index f5e973053a..41db2d5f85 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -37,8 +37,10 @@ import GHC.Tc.Types.Evidence import GHC.Core.Type import GHC.Types.Name.Set import GHC.Types.Basic +import GHC.Types.SourceText import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Var +import GHC.Types.Fixity import GHC.Data.Bag import GHC.Data.FastString import GHC.Data.BooleanFormula (LBooleanFormula) @@ -982,7 +984,7 @@ data Sig pass -- For details on above see note [Api annotations] in GHC.Parser.Annotation | SpecInstSig (XSpecInstSig pass) SourceText (LHsSigType pass) - -- Note [Pragma source text] in GHC.Types.Basic + -- Note [Pragma source text] in GHC.Types.SourceText -- | A minimal complete definition pragma -- @@ -995,7 +997,7 @@ data Sig pass -- For details on above see note [Api annotations] in GHC.Parser.Annotation | MinimalSig (XMinimalSig pass) SourceText (LBooleanFormula (LIdP pass)) - -- Note [Pragma source text] in GHC.Types.Basic + -- Note [Pragma source text] in GHC.Types.SourceText -- | A "set cost centre" pragma for declarations -- @@ -1006,7 +1008,7 @@ data Sig pass -- > {-# SCC funName "cost_centre_name" #-} | SCCFunSig (XSCCFunSig pass) - SourceText -- Note [Pragma source text] in GHC.Types.Basic + SourceText -- Note [Pragma source text] in GHC.Types.SourceText (LIdP pass) -- Function name (Maybe (XRec pass StringLiteral)) -- | A complete match pragma diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index 78a7fd3320..51f1e2a127 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -114,6 +114,7 @@ import GHC.Types.ForeignCall import GHC.Hs.Extension import GHC.Types.Name import GHC.Types.Name.Set +import GHC.Types.Fixity -- others: import GHC.Core.Class @@ -121,7 +122,9 @@ import GHC.Utils.Outputable import GHC.Utils.Misc import GHC.Utils.Panic import GHC.Types.SrcLoc +import GHC.Types.SourceText import GHC.Core.Type +import GHC.Unit.Module.Warnings import GHC.Data.Bag import GHC.Data.Maybe @@ -2372,7 +2375,7 @@ instance Outputable ForeignExport where -- | Located Rule Declarations type LRuleDecls pass = XRec pass (RuleDecls pass) - -- Note [Pragma source text] in GHC.Types.Basic + -- Note [Pragma source text] in GHC.Types.SourceText -- | Rule Declarations data RuleDecls pass = HsRules { rds_ext :: XCRuleDecls pass , rds_src :: SourceText @@ -2515,7 +2518,7 @@ We use exported entities for things to deprecate. -- | Located Warning Declarations type LWarnDecls pass = XRec pass (WarnDecls pass) - -- Note [Pragma source text] in GHC.Types.Basic + -- Note [Pragma source text] in GHC.Types.SourceText -- | Warning pragma Declarations data WarnDecls pass = Warnings { wd_ext :: XWarnings pass , wd_src :: SourceText @@ -2563,7 +2566,7 @@ type LAnnDecl pass = XRec pass (AnnDecl pass) -- | Annotation Declaration data AnnDecl pass = HsAnnotation (XHsAnnotation pass) - SourceText -- Note [Pragma source text] in GHC.Types.Basic + SourceText -- Note [Pragma source text] in GHC.Types.SourceText (AnnProvenance (IdP pass)) (XRec pass (HsExpr pass)) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnType' diff --git a/compiler/GHC/Hs/Dump.hs b/compiler/GHC/Hs/Dump.hs index 6ce865a36a..639c738b74 100644 --- a/compiler/GHC/Hs/Dump.hs +++ b/compiler/GHC/Hs/Dump.hs @@ -17,19 +17,21 @@ module GHC.Hs.Dump ( import GHC.Prelude -import Data.Data hiding (Fixity) +import GHC.Hs + +import GHC.Core.DataCon + import GHC.Data.Bag -import GHC.Types.Basic import GHC.Data.FastString import GHC.Types.Name.Set import GHC.Types.Name -import GHC.Core.DataCon import GHC.Types.SrcLoc -import GHC.Hs import GHC.Types.Var +import GHC.Types.SourceText import GHC.Unit.Module import GHC.Utils.Outputable +import Data.Data hiding (Fixity) import qualified Data.ByteString as B data BlankSrcSpan = BlankSrcSpan | NoBlankSrcSpan diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index 724f37cbd7..ef8934b831 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -42,8 +42,10 @@ import GHC.Types.Id( Id ) import GHC.Types.Name import GHC.Types.Name.Set import GHC.Types.Basic -import GHC.Core.ConLike +import GHC.Types.Fixity +import GHC.Types.SourceText import GHC.Types.SrcLoc +import GHC.Core.ConLike import GHC.Unit.Module (ModuleName) import GHC.Utils.Misc import GHC.Utils.Outputable @@ -831,7 +833,7 @@ instance (Outputable a, Outputable b) => Outputable (HsExpansion a b) where -- | A pragma, written as {-# ... #-}, that may appear within an expression. data HsPragE p = HsPragSCC (XSCC p) - SourceText -- Note [Pragma source text] in GHC.Types.Basic + SourceText -- Note [Pragma source text] in GHC.Types.SourceText StringLiteral -- "set cost centre" SCC pragma -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 1faadf38bd..0aec281312 100644 --- a/compiler/GHC/Hs/ImpExp.hs +++ b/compiler/GHC/Hs/ImpExp.hs @@ -19,7 +19,7 @@ import GHC.Prelude import GHC.Unit.Module ( ModuleName, IsBootInterface(..) ) import GHC.Hs.Doc ( HsDocString ) import GHC.Types.Name.Occurrence ( HasOccName(..), isTcOcc, isSymOcc ) -import GHC.Types.Basic ( SourceText(..), StringLiteral(..), pprWithSourceText ) +import GHC.Types.SourceText ( SourceText(..), StringLiteral(..), pprWithSourceText ) import GHC.Types.FieldLabel ( FieldLbl(..) ) import GHC.Utils.Outputable @@ -79,7 +79,7 @@ data ImportDecl pass = ImportDecl { ideclExt :: XCImportDecl pass, ideclSourceSrc :: SourceText, - -- Note [Pragma source text] in GHC.Types.Basic + -- Note [Pragma source text] in GHC.Types.SourceText ideclName :: XRec pass ModuleName, -- ^ Module name. ideclPkgQual :: Maybe StringLiteral, -- ^ Package qualifier. ideclSource :: IsBootInterface, -- ^ IsBoot <=> {-\# SOURCE \#-} import diff --git a/compiler/GHC/Hs/Lit.hs b/compiler/GHC/Hs/Lit.hs index 967d41f283..75ea3ef469 100644 --- a/compiler/GHC/Hs/Lit.hs +++ b/compiler/GHC/Hs/Lit.hs @@ -11,9 +11,9 @@ (c) The University of Glasgow 2006 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[HsLit]{Abstract syntax: source-language literals} -} +-- | Source-language literals module GHC.Hs.Lit where #include "HsVersions.h" @@ -21,10 +21,8 @@ module GHC.Hs.Lit where import GHC.Prelude import {-# SOURCE #-} GHC.Hs.Expr( HsExpr, pprExpr ) -import GHC.Types.Basic - ( IntegralLit(..), FractionalLit(..), negateIntegralLit - , negateFractionalLit, SourceText(..), pprWithSourceText - , PprPrec(..), topPrec ) +import GHC.Types.Basic (PprPrec(..), topPrec ) +import GHC.Types.SourceText import GHC.Core.Type import GHC.Utils.Outputable import GHC.Utils.Panic diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs index b2507a0865..3033806ddd 100644 --- a/compiler/GHC/Hs/Pat.hs +++ b/compiler/GHC/Hs/Pat.hs @@ -57,6 +57,7 @@ import GHC.Hs.Extension import GHC.Hs.Type import GHC.Tc.Types.Evidence import GHC.Types.Basic +import GHC.Types.SourceText -- others: import GHC.Core.Ppr ( {- instance OutputableBndr TyVar -} ) import GHC.Builtin.Types diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 2e9f7b60c1..a193eefa12 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -87,6 +87,7 @@ import {-# SOURCE #-} GHC.Hs.Expr ( HsSplice, pprSplice ) import GHC.Hs.Extension import GHC.Types.Id ( Id ) +import GHC.Types.SourceText import GHC.Types.Name( Name, NamedThing(getName) ) import GHC.Types.Name.Reader ( RdrName ) import GHC.Core.DataCon( HsSrcBang(..), HsImplBang(..), diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index c1edb7ef3e..8252d91249 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -116,8 +116,6 @@ import GHC.Hs.Lit import GHC.Hs.Extension import GHC.Tc.Types.Evidence -import GHC.Types.Name.Reader -import GHC.Types.Var import GHC.Core.TyCo.Rep import GHC.Core.Multiplicity ( pattern Many ) import GHC.Builtin.Types ( unitTy ) @@ -128,8 +126,12 @@ import GHC.Types.Id import GHC.Types.Name import GHC.Types.Name.Set hiding ( unitFV ) import GHC.Types.Name.Env +import GHC.Types.Name.Reader +import GHC.Types.Var import GHC.Types.Basic import GHC.Types.SrcLoc +import GHC.Types.Fixity +import GHC.Types.SourceText import GHC.Data.FastString import GHC.Data.Bag import GHC.Settings.Constants |