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/Builtin | |
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/Builtin')
-rw-r--r-- | compiler/GHC/Builtin/PrimOps.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types/Prim.hs | 7 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Utils.hs | 27 |
4 files changed, 25 insertions, 18 deletions
diff --git a/compiler/GHC/Builtin/PrimOps.hs b/compiler/GHC/Builtin/PrimOps.hs index 8ed04097f7..4ad8652922 100644 --- a/compiler/GHC/Builtin/PrimOps.hs +++ b/compiler/GHC/Builtin/PrimOps.hs @@ -39,10 +39,11 @@ import GHC.Builtin.Names ( gHC_PRIMOPWRAPPERS ) import GHC.Core.TyCon ( TyCon, isPrimTyCon, PrimRep(..) ) import GHC.Core.Type import GHC.Types.RepType ( tyConPrimRep1 ) -import GHC.Types.Basic ( Arity, Fixity(..), FixityDirection(..), Boxity(..), - SourceText(..) ) +import GHC.Types.Basic ( Arity, Boxity(..) ) +import GHC.Types.Fixity ( Fixity(..), FixityDirection(..) ) import GHC.Types.SrcLoc ( wiredInSrcSpan ) import GHC.Types.ForeignCall ( CLabelString ) +import GHC.Types.SourceText ( SourceText(..) ) import GHC.Types.Unique ( Unique) import GHC.Builtin.Uniques (mkPrimOpIdUnique, mkPrimOpWrapperUnique ) import GHC.Unit.Types ( Unit ) diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index 771db90d85..52febf72d2 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -164,13 +164,15 @@ import GHC.Builtin.Uniques -- others: import GHC.Core.Coercion.Axiom import GHC.Types.Id +import GHC.Types.TyThing +import GHC.Types.SourceText import GHC.Types.Var (VarBndr (Bndr)) import GHC.Settings.Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE, mAX_SUM_SIZE ) import GHC.Unit.Module ( Module ) import GHC.Core.Type import GHC.Types.RepType import GHC.Core.DataCon -import {-# SOURCE #-} GHC.Core.ConLike +import GHC.Core.ConLike import GHC.Core.TyCon import GHC.Core.Class ( Class, mkClass ) import GHC.Types.Name.Reader diff --git a/compiler/GHC/Builtin/Types/Prim.hs b/compiler/GHC/Builtin/Types/Prim.hs index 1b3d22fc21..fc74596e45 100644 --- a/compiler/GHC/Builtin/Types/Prim.hs +++ b/compiler/GHC/Builtin/Types/Prim.hs @@ -115,6 +115,7 @@ import {-# SOURCE #-} GHC.Builtin.Types import GHC.Types.Var ( TyVar, mkTyVar ) import GHC.Types.Name +import {-# SOURCE #-} GHC.Types.TyThing import GHC.Core.TyCon import GHC.Types.SrcLoc import GHC.Types.Unique @@ -199,14 +200,14 @@ mkPrimTc :: FastString -> Unique -> TyCon -> Name mkPrimTc fs unique tycon = mkWiredInName gHC_PRIM (mkTcOccFS fs) unique - (ATyCon tycon) -- Relevant TyCon + (mkATyCon tycon) -- Relevant TyCon UserSyntax mkBuiltInPrimTc :: FastString -> Unique -> TyCon -> Name mkBuiltInPrimTc fs unique tycon = mkWiredInName gHC_PRIM (mkTcOccFS fs) unique - (ATyCon tycon) -- Relevant TyCon + (mkATyCon tycon) -- Relevant TyCon BuiltInSyntax @@ -547,7 +548,7 @@ mkPrimTyConName = mkPrimTcName BuiltInSyntax mkPrimTcName :: BuiltInSyntax -> FastString -> Unique -> TyCon -> Name mkPrimTcName built_in_syntax occ key tycon - = mkWiredInName gHC_PRIM (mkTcOccFS occ) key (ATyCon tycon) built_in_syntax + = mkWiredInName gHC_PRIM (mkTcOccFS occ) key (mkATyCon tycon) built_in_syntax ----------------------------- -- | Given a RuntimeRep, applies TYPE to it. diff --git a/compiler/GHC/Builtin/Utils.hs b/compiler/GHC/Builtin/Utils.hs index 3aeac609d9..1d69b47f37 100644 --- a/compiler/GHC/Builtin/Utils.hs +++ b/compiler/GHC/Builtin/Utils.hs @@ -50,31 +50,34 @@ module GHC.Builtin.Utils ( import GHC.Prelude import GHC.Builtin.Uniques -import GHC.Types.Unique ( isValidKnownKeyUnique ) - -import GHC.Core.ConLike ( ConLike(..) ) +import GHC.Builtin.PrimOps +import GHC.Builtin.Types +import GHC.Builtin.Types.Literals ( typeNatTyCons ) +import GHC.Builtin.Types.Prim import GHC.Builtin.Names.TH ( templateHaskellNames ) import GHC.Builtin.Names + +import GHC.Core.ConLike ( ConLike(..) ) import GHC.Core.Opt.ConstantFold -import GHC.Types.Avail -import GHC.Builtin.PrimOps import GHC.Core.DataCon +import GHC.Core.Class +import GHC.Core.TyCon + +import GHC.Types.Avail import GHC.Types.Basic import GHC.Types.Id import GHC.Types.Name import GHC.Types.Name.Env import GHC.Types.Id.Make -import GHC.Utils.Outputable -import GHC.Builtin.Types.Prim -import GHC.Builtin.Types -import GHC.Driver.Types -import GHC.Core.Class -import GHC.Core.TyCon import GHC.Types.Unique.FM +import GHC.Types.TyThing +import GHC.Types.Unique ( isValidKnownKeyUnique ) + +import GHC.Utils.Outputable import GHC.Utils.Misc as Utils import GHC.Utils.Panic -import GHC.Builtin.Types.Literals ( typeNatTyCons ) import GHC.Hs.Doc +import GHC.Unit.Module.ModIface (IfaceExport) import Control.Applicative ((<|>)) import Data.List ( intercalate , find ) |