summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Deriv/Generate.hs2
-rw-r--r--compiler/GHC/Tc/Deriv/Generics.hs4
-rw-r--r--compiler/GHC/Tc/Deriv/Utils.hs3
-rw-r--r--compiler/GHC/Tc/Errors/Hole.hs3
-rw-r--r--compiler/GHC/Tc/Gen/Annotation.hs15
-rw-r--r--compiler/GHC/Tc/Gen/Bind.hs1
-rw-r--r--compiler/GHC/Tc/Gen/Export.hs23
-rw-r--r--compiler/GHC/Tc/Gen/Expr.hs1
-rw-r--r--compiler/GHC/Tc/Gen/Match.hs22
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs118
-rw-r--r--compiler/GHC/Tc/Instance/Class.hs20
-rw-r--r--compiler/GHC/Tc/Instance/Family.hs43
-rw-r--r--compiler/GHC/Tc/Instance/Typeable.hs5
-rw-r--r--compiler/GHC/Tc/Module.hs127
-rw-r--r--compiler/GHC/Tc/Module.hs-boot2
-rw-r--r--compiler/GHC/Tc/Plugin.hs13
-rw-r--r--compiler/GHC/Tc/Solver/Monad.hs3
-rw-r--r--compiler/GHC/Tc/TyCl.hs38
-rw-r--r--compiler/GHC/Tc/TyCl/Build.hs1
-rw-r--r--compiler/GHC/Tc/TyCl/Class.hs2
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs2
-rw-r--r--compiler/GHC/Tc/TyCl/Utils.hs41
-rw-r--r--compiler/GHC/Tc/Types.hs60
-rw-r--r--compiler/GHC/Tc/Types/EvTerm.hs22
-rw-r--r--compiler/GHC/Tc/Utils/Backpack.hs80
-rw-r--r--compiler/GHC/Tc/Utils/Env.hs49
-rw-r--r--compiler/GHC/Tc/Utils/Instantiate.hs50
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs48
-rw-r--r--compiler/GHC/Tc/Utils/TcType.hs2
-rw-r--r--compiler/GHC/Tc/Utils/Zonk.hs41
30 files changed, 512 insertions, 329 deletions
diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs
index 400d4afbe7..33c0765c69 100644
--- a/compiler/GHC/Tc/Deriv/Generate.hs
+++ b/compiler/GHC/Tc/Deriv/Generate.hs
@@ -46,8 +46,10 @@ import GHC.Tc.Utils.Monad
import GHC.Hs
import GHC.Types.Name.Reader
import GHC.Types.Basic
+import GHC.Types.Fixity
import GHC.Core.DataCon
import GHC.Types.Name
+import GHC.Types.SourceText
import GHC.Driver.Session
import GHC.Builtin.Utils
diff --git a/compiler/GHC/Tc/Deriv/Generics.hs b/compiler/GHC/Tc/Deriv/Generics.hs
index 86a5cd7ba5..5a9e329ae2 100644
--- a/compiler/GHC/Tc/Deriv/Generics.hs
+++ b/compiler/GHC/Tc/Deriv/Generics.hs
@@ -37,6 +37,9 @@ import GHC.Unit.Module ( moduleName, moduleNameFS
import GHC.Iface.Env ( newGlobalBinder )
import GHC.Types.Name hiding ( varName )
import GHC.Types.Name.Reader
+import GHC.Types.Fixity.Env
+import GHC.Types.SourceText
+import GHC.Types.Fixity
import GHC.Types.Basic
import GHC.Builtin.Types.Prim
import GHC.Builtin.Types
@@ -44,7 +47,6 @@ import GHC.Builtin.Names
import GHC.Tc.Utils.Env
import GHC.Tc.Utils.Monad
import GHC.Driver.Session
-import GHC.Driver.Types
import GHC.Utils.Error( Validity(..), andValid )
import GHC.Types.SrcLoc
import GHC.Data.Bag
diff --git a/compiler/GHC/Tc/Deriv/Utils.hs b/compiler/GHC/Tc/Deriv/Utils.hs
index 9cb56bf1c5..f4d71a38a1 100644
--- a/compiler/GHC/Tc/Deriv/Utils.hs
+++ b/compiler/GHC/Tc/Deriv/Utils.hs
@@ -30,12 +30,13 @@ import GHC.Core.Class
import GHC.Core.DataCon
import GHC.Driver.Session
import GHC.Utils.Error
-import GHC.Driver.Types (lookupFixity, mi_fix)
+import GHC.Types.Fixity.Env (lookupFixity)
import GHC.Hs
import GHC.Tc.Utils.Instantiate
import GHC.Core.InstEnv
import GHC.Iface.Load (loadInterfaceForName)
import GHC.Unit.Module (getModule)
+import GHC.Unit.Module.ModIface (mi_fix)
import GHC.Types.Name
import GHC.Utils.Outputable
import GHC.Utils.Panic
diff --git a/compiler/GHC/Tc/Errors/Hole.hs b/compiler/GHC/Tc/Errors/Hole.hs
index b50ff2e804..5ae117bf55 100644
--- a/compiler/GHC/Tc/Errors/Hole.hs
+++ b/compiler/GHC/Tc/Errors/Hole.hs
@@ -27,6 +27,7 @@ import GHC.Builtin.Names ( gHC_ERR )
import GHC.Types.Id
import GHC.Types.Var.Set
import GHC.Types.Var.Env
+import GHC.Types.TyThing
import GHC.Data.Bag
import GHC.Core.ConLike ( ConLike(..) )
import GHC.Utils.Misc
@@ -50,7 +51,7 @@ import GHC.Tc.Utils.Unify ( tcSubTypeSigma )
import GHC.HsToCore.Docs ( extractDocs )
import qualified Data.Map as Map
import GHC.Hs.Doc ( unpackHDS, DeclDocMap(..) )
-import GHC.Driver.Types ( ModIface_(..) )
+import GHC.Unit.Module.ModIface ( ModIface_(..) )
import GHC.Iface.Load ( loadInterfaceForNameMaybe )
import GHC.Builtin.Utils (knownKeyNames)
diff --git a/compiler/GHC/Tc/Gen/Annotation.hs b/compiler/GHC/Tc/Gen/Annotation.hs
index 6e9c7ac5ed..90a703b6b5 100644
--- a/compiler/GHC/Tc/Gen/Annotation.hs
+++ b/compiler/GHC/Tc/Gen/Annotation.hs
@@ -12,18 +12,23 @@ module GHC.Tc.Gen.Annotation ( tcAnnotations, annCtxt ) where
import GHC.Prelude
+import GHC.Driver.Session
+import GHC.Driver.Env
+
import {-# SOURCE #-} GHC.Tc.Gen.Splice ( runAnnotation )
+import GHC.Tc.Utils.Monad
+
import GHC.Unit.Module
-import GHC.Driver.Session
-import Control.Monad ( when )
import GHC.Hs
+
+import GHC.Utils.Outputable
+
import GHC.Types.Name
import GHC.Types.Annotations
-import GHC.Tc.Utils.Monad
import GHC.Types.SrcLoc
-import GHC.Utils.Outputable
-import GHC.Driver.Types
+
+import Control.Monad ( when )
-- Some platforms don't support the interpreter, and compilation on those
-- platforms shouldn't fail just due to annotations
diff --git a/compiler/GHC/Tc/Gen/Bind.hs b/compiler/GHC/Tc/Gen/Bind.hs
index 03ce1353a0..97d997897f 100644
--- a/compiler/GHC/Tc/Gen/Bind.hs
+++ b/compiler/GHC/Tc/Gen/Bind.hs
@@ -49,6 +49,7 @@ import GHC.Tc.Utils.TcType
import GHC.Core.Type (mkStrLitTy, tidyOpenType, mkCastTy)
import GHC.Builtin.Types.Prim
import GHC.Builtin.Types( mkBoxedTupleTy )
+import GHC.Types.SourceText
import GHC.Types.Id
import GHC.Types.Var as Var
import GHC.Types.Var.Set
diff --git a/compiler/GHC/Tc/Gen/Export.hs b/compiler/GHC/Tc/Gen/Export.hs
index 9b503da19c..d5420a4027 100644
--- a/compiler/GHC/Tc/Gen/Export.hs
+++ b/compiler/GHC/Tc/Gen/Export.hs
@@ -9,7 +9,6 @@ import GHC.Prelude
import GHC.Hs
import GHC.Builtin.Names
-import GHC.Types.Name.Reader
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Env
import GHC.Tc.Utils.TcType
@@ -17,26 +16,30 @@ import GHC.Rename.Names
import GHC.Rename.Env
import GHC.Rename.Unbound ( reportUnboundName )
import GHC.Utils.Error
-import GHC.Types.Id
-import GHC.Types.Id.Info
import GHC.Unit.Module
-import GHC.Types.Name
-import GHC.Types.Name.Env
-import GHC.Types.Name.Set
-import GHC.Types.Avail
+import GHC.Unit.Module.Imported
import GHC.Core.TyCon
-import GHC.Types.SrcLoc as SrcLoc
-import GHC.Driver.Types
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Core.ConLike
import GHC.Core.DataCon
import GHC.Core.PatSyn
import GHC.Data.Maybe
-import GHC.Types.Unique.Set
import GHC.Utils.Misc (capitalise)
import GHC.Data.FastString (fsLit)
+import GHC.Types.Unique.Set
+import GHC.Types.SrcLoc as SrcLoc
+import GHC.Types.Name
+import GHC.Types.Name.Env
+import GHC.Types.Name.Set
+import GHC.Types.Avail
+import GHC.Types.SourceFile
+import GHC.Types.Id
+import GHC.Types.Id.Info
+import GHC.Types.TyThing
+import GHC.Types.Name.Reader
+
import Control.Monad
import GHC.Driver.Session
import GHC.Parser.PostProcess ( setRdrNameSpace )
diff --git a/compiler/GHC/Tc/Gen/Expr.hs b/compiler/GHC/Tc/Gen/Expr.hs
index a64154facf..564ad46660 100644
--- a/compiler/GHC/Tc/Gen/Expr.hs
+++ b/compiler/GHC/Tc/Gen/Expr.hs
@@ -36,6 +36,7 @@ import GHC.Tc.Utils.Zonk
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Unify
import GHC.Types.Basic
+import GHC.Types.SourceText
import GHC.Core.Multiplicity
import GHC.Core.UsageEnv
import GHC.Tc.Utils.Instantiate
diff --git a/compiler/GHC/Tc/Gen/Match.hs b/compiler/GHC/Tc/Gen/Match.hs
index ff01093a34..1b9e0185f3 100644
--- a/compiler/GHC/Tc/Gen/Match.hs
+++ b/compiler/GHC/Tc/Gen/Match.hs
@@ -40,8 +40,6 @@ import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcSyntaxOp, tcInferRho, tcInferRhoNC
, tcCheckMonoExpr, tcCheckMonoExprNC
, tcCheckPolyExpr )
-import GHC.Types.Basic (LexicalFixity(..))
-import GHC.Hs
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Env
import GHC.Tc.Gen.Pat
@@ -51,21 +49,27 @@ import GHC.Tc.Utils.TcType
import GHC.Tc.Gen.Bind
import GHC.Tc.Utils.Unify
import GHC.Tc.Types.Origin
+import GHC.Tc.Types.Evidence
+
import GHC.Core.Multiplicity
import GHC.Core.UsageEnv
-import GHC.Types.Name
-import GHC.Builtin.Types
-import GHC.Types.Id
import GHC.Core.TyCon
+-- Create chunkified tuple tybes for monad comprehensions
+import GHC.Core.Make
+
+import GHC.Hs
+
+import GHC.Builtin.Types
import GHC.Builtin.Types.Prim
-import GHC.Tc.Types.Evidence
+
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc
-import GHC.Types.SrcLoc
--- Create chunkified tuple tybes for monad comprehensions
-import GHC.Core.Make
+import GHC.Types.Fixity (LexicalFixity(..))
+import GHC.Types.Name
+import GHC.Types.Id
+import GHC.Types.SrcLoc
import Control.Monad
import Control.Arrow ( second )
diff --git a/compiler/GHC/Tc/Gen/Splice.hs b/compiler/GHC/Tc/Gen/Splice.hs
index c83890b1ae..c9c134dfbe 100644
--- a/compiler/GHC/Tc/Gen/Splice.hs
+++ b/compiler/GHC/Tc/Gen/Splice.hs
@@ -34,89 +34,98 @@ module GHC.Tc.Gen.Splice(
import GHC.Prelude
+import GHC.Driver.Plugins
+import GHC.Driver.Main
+import GHC.Driver.Session
+import GHC.Driver.Env
+import GHC.Driver.Hooks
+
import GHC.Hs
-import GHC.Types.Annotations
-import GHC.Driver.Finder
-import GHC.Types.Name
+
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.TcType
-import GHC.Core.Multiplicity
-
-import GHC.Utils.Outputable
import GHC.Tc.Gen.Expr
-import GHC.Types.SrcLoc
-import GHC.Builtin.Names.TH
import GHC.Tc.Utils.Unify
import GHC.Tc.Utils.Env
import GHC.Tc.Types.Origin
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Solver
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Instance.Family
+import GHC.Tc.Utils.Instantiate
+
+import GHC.Core.Multiplicity
import GHC.Core.Coercion( etaExpandCoAxBranch )
-import GHC.SysTools.FileCleanup ( newTempName, TempFileLifetime(..) )
+import GHC.Core.Type as Type
+import GHC.Core.TyCo.Rep as TyCoRep
+import GHC.Core.FamInstEnv
+import GHC.Core.InstEnv as InstEnv
-import Control.Monad
+import GHC.Builtin.Names.TH
+import GHC.Builtin.Names
+import GHC.Builtin.Types
+
+import GHC.ThToHs
+import GHC.HsToCore.Expr
+import GHC.HsToCore.Monad
+import GHC.IfaceToCore
+import GHC.Iface.Load
import GHCi.Message
import GHCi.RemoteTypes
import GHC.Runtime.Interpreter
import GHC.Runtime.Interpreter.Types
-import GHC.Driver.Main
- -- These imports are the reason that GHC.Tc.Gen.Splice
- -- is very high up the module hierarchy
+
import GHC.Rename.Splice( traceSplice, SpliceInfo(..))
-import GHC.Types.Name.Reader
-import GHC.Driver.Types
-import GHC.ThToHs
import GHC.Rename.Expr
import GHC.Rename.Env
import GHC.Rename.Utils ( HsDocContext(..) )
import GHC.Rename.Fixity ( lookupFixityRn_help )
import GHC.Rename.HsType
-import GHC.Tc.Utils.Zonk
-import GHC.Tc.Solver
-import GHC.Core.Type as Type
-import GHC.Types.Name.Set
-import GHC.Tc.Utils.TcMType
-import GHC.Tc.Gen.HsType
-import GHC.IfaceToCore
-import GHC.Core.TyCo.Rep as TyCoRep
-import GHC.Tc.Instance.Family
-import GHC.Core.FamInstEnv
-import GHC.Core.InstEnv as InstEnv
-import GHC.Tc.Utils.Instantiate
-import GHC.Types.Name.Env
-import GHC.Builtin.Names
-import GHC.Builtin.Types
-import GHC.Types.Name.Occurrence as OccName
-import GHC.Driver.Hooks
-import GHC.Types.Var
-import GHC.Unit.Module
-import GHC.Iface.Load
+
import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Core.Coercion.Axiom
import GHC.Core.PatSyn
import GHC.Core.ConLike
import GHC.Core.DataCon as DataCon
-import GHC.Tc.Types.Evidence
+
+import GHC.Types.SrcLoc
+import GHC.Types.Name.Env
+import GHC.Types.Name.Set
+import GHC.Types.Name.Reader
+import GHC.Types.Name.Occurrence as OccName
+import GHC.Types.Var
import GHC.Types.Id
import GHC.Types.Id.Info
-import GHC.HsToCore.Expr
-import GHC.HsToCore.Monad
+import GHC.Types.Unique
+import GHC.Types.Var.Set
+import GHC.Types.Meta
+import GHC.Types.Basic hiding( SuccessFlag(..) )
+import GHC.Types.Fixity as Hs
+import GHC.Types.Annotations
+import GHC.Types.Name
import GHC.Serialized
+
+import GHC.Unit.Finder
+import GHC.Unit.Module
+import GHC.Unit.Module.ModIface
+import GHC.Unit.Module.Deps
+
import GHC.Utils.Error
import GHC.Utils.Misc
-import GHC.Types.Unique
-import GHC.Types.Var.Set
-import Data.List ( find )
-import Data.Maybe
-import GHC.Data.FastString
-import GHC.Types.Basic as BasicTypes hiding( SuccessFlag(..) )
-import GHC.Data.Maybe( MaybeErr(..) )
-import GHC.Driver.Session
import GHC.Utils.Panic as Panic
import GHC.Utils.Lexeme
-import qualified GHC.Data.EnumSet as EnumSet
-import GHC.Driver.Plugins
+import GHC.Utils.Outputable
+
+import GHC.SysTools.FileCleanup ( newTempName, TempFileLifetime(..) )
+
import GHC.Data.Bag
+import GHC.Data.FastString
+import GHC.Data.Maybe( MaybeErr(..) )
+import qualified GHC.Data.EnumSet as EnumSet
import qualified Language.Haskell.TH as TH
-- THSyntax gives access to internal functions and data types
@@ -128,9 +137,12 @@ import GHC.Desugar ( AnnotationWrapper(..) )
import Unsafe.Coerce ( unsafeCoerce )
#endif
+import Control.Monad
import Control.Exception
import Data.Binary
import Data.Binary.Get
+import Data.List ( find )
+import Data.Maybe
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
import Data.Dynamic ( fromDynamic, toDyn )
@@ -2295,10 +2307,10 @@ reifyFixity name
= do { (found, fix) <- lookupFixityRn_help name
; return (if found then Just (conv_fix fix) else Nothing) }
where
- conv_fix (BasicTypes.Fixity _ i d) = TH.Fixity i (conv_dir d)
- conv_dir BasicTypes.InfixR = TH.InfixR
- conv_dir BasicTypes.InfixL = TH.InfixL
- conv_dir BasicTypes.InfixN = TH.InfixN
+ conv_fix (Hs.Fixity _ i d) = TH.Fixity i (conv_dir d)
+ conv_dir Hs.InfixR = TH.InfixR
+ conv_dir Hs.InfixL = TH.InfixL
+ conv_dir Hs.InfixN = TH.InfixN
reifyUnpackedness :: DataCon.SrcUnpackedness -> TH.SourceUnpackedness
reifyUnpackedness NoSrcUnpack = TH.NoSourceUnpackedness
diff --git a/compiler/GHC/Tc/Instance/Class.hs b/compiler/GHC/Tc/Instance/Class.hs
index 94a170692a..2e94d477b1 100644
--- a/compiler/GHC/Tc/Instance/Class.hs
+++ b/compiler/GHC/Tc/Instance/Class.hs
@@ -13,6 +13,8 @@ module GHC.Tc.Instance.Class (
import GHC.Prelude
+import GHC.Driver.Session
+
import GHC.Tc.Utils.Env
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.TcType
@@ -20,30 +22,32 @@ import GHC.Tc.Utils.Instantiate( tcInstType )
import GHC.Tc.Instance.Typeable
import GHC.Tc.Utils.TcMType
import GHC.Tc.Types.Evidence
-import GHC.Core.Predicate
-import GHC.Rename.Env( addUsedGRE )
-import GHC.Types.Name.Reader( lookupGRE_FieldLabel )
-import GHC.Core.InstEnv
import GHC.Tc.Utils.Instantiate( instDFunType )
import GHC.Tc.Instance.Family( tcGetFamInstEnvs, tcInstNewTyCon_maybe, tcLookupDataFamInst )
+import GHC.Rename.Env( addUsedGRE )
import GHC.Builtin.Types
import GHC.Builtin.Types.Prim( eqPrimTyCon, eqReprPrimTyCon )
import GHC.Builtin.Names
+import GHC.Types.Name.Reader( lookupGRE_FieldLabel )
+import GHC.Types.SafeHaskell
+import GHC.Types.Name ( Name, pprDefinedAt )
+import GHC.Types.Var.Env ( VarEnv )
import GHC.Types.Id
+
+import GHC.Core.Predicate
+import GHC.Core.InstEnv
import GHC.Core.Type
import GHC.Core.Make ( mkStringExprFS, mkNaturalExpr )
-
-import GHC.Types.Name ( Name, pprDefinedAt )
-import GHC.Types.Var.Env ( VarEnv )
import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Core.Class
-import GHC.Driver.Session
+
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc( splitAtList, fstOf3 )
+
import Data.Maybe
{- *******************************************************************
diff --git a/compiler/GHC/Tc/Instance/Family.hs b/compiler/GHC/Tc/Instance/Family.hs
index 8a2c5b0e7a..620e585f8f 100644
--- a/compiler/GHC/Tc/Instance/Family.hs
+++ b/compiler/GHC/Tc/Instance/Family.hs
@@ -14,33 +14,46 @@ module GHC.Tc.Instance.Family (
import GHC.Prelude
-import GHC.Driver.Types
+import GHC.Driver.Session
+import GHC.Driver.Env
+
import GHC.Core.FamInstEnv
import GHC.Core.InstEnv( roughMatchTcs )
import GHC.Core.Coercion
-import GHC.Tc.Types.Evidence
-import GHC.Iface.Load
-import GHC.Tc.Utils.Monad
-import GHC.Tc.Utils.Instantiate( freshenTyVarBndrs, freshenCoVarBndrsX )
-import GHC.Types.SrcLoc as SrcLoc
import GHC.Core.TyCon
-import GHC.Tc.Utils.TcType
import GHC.Core.Coercion.Axiom
-import GHC.Driver.Session
-import GHC.Unit.Module
-import GHC.Utils.Outputable
-import GHC.Utils.Misc
-import GHC.Types.Name.Reader
import GHC.Core.DataCon ( dataConName )
-import GHC.Data.Maybe
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.FVs
import GHC.Core.TyCo.Ppr ( pprWithExplicitKindsWhen )
+
+import GHC.Iface.Load
+
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Instantiate( freshenTyVarBndrs, freshenCoVarBndrsX )
+import GHC.Tc.Utils.TcType
+
+import GHC.Unit.External
+import GHC.Unit.Module
+import GHC.Unit.Module.ModIface
+import GHC.Unit.Module.ModDetails
+import GHC.Unit.Module.Deps
+import GHC.Unit.Home.ModInfo
+
+import GHC.Types.SrcLoc as SrcLoc
+import GHC.Types.Name.Reader
import GHC.Types.Name
-import GHC.Utils.Panic
import GHC.Types.Var.Set
+
+import GHC.Utils.Outputable
+import GHC.Utils.Misc
+import GHC.Utils.Panic
import GHC.Utils.FV
+
import GHC.Data.Bag( Bag, unionBags, unitBag )
+import GHC.Data.Maybe
+
import Control.Monad
import Data.List ( sortBy )
import Data.List.NonEmpty ( NonEmpty(..) )
@@ -215,7 +228,7 @@ two modules are consistent--because we checked that when we compiled M.
For every other pair of family instance modules we import (directly or
indirectly), we check that they are consistent now. (So that we can be
-certain that the modules in our `GHC.Driver.Types.dep_finsts' are consistent.)
+certain that the modules in our `GHC.Driver.Env.dep_finsts' are consistent.)
There is some fancy footwork regarding hs-boot module loops, see
Note [Don't check hs-boot type family instances too early]
diff --git a/compiler/GHC/Tc/Instance/Typeable.hs b/compiler/GHC/Tc/Instance/Typeable.hs
index 7758caf712..09f90567db 100644
--- a/compiler/GHC/Tc/Instance/Typeable.hs
+++ b/compiler/GHC/Tc/Instance/Typeable.hs
@@ -15,14 +15,15 @@ module GHC.Tc.Instance.Typeable(mkTypeableBinds, tyConIsTypeable) where
import GHC.Prelude
import GHC.Platform
-import GHC.Types.Basic ( Boxity(..), neverInlinePragma, SourceText(..) )
+import GHC.Types.Basic ( Boxity(..), neverInlinePragma )
+import GHC.Types.SourceText ( SourceText(..) )
import GHC.Iface.Env( newGlobalBinder )
import GHC.Core.TyCo.Rep( Type(..), TyLit(..) )
import GHC.Tc.Utils.Env
import GHC.Tc.Types.Evidence ( mkWpTyApps )
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.TcType
-import GHC.Driver.Types ( lookupId )
+import GHC.Types.TyThing ( lookupId )
import GHC.Builtin.Names
import GHC.Builtin.Types.Prim ( primTyCons )
import GHC.Builtin.Types
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 37b399bdd1..94582b00a9 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -48,28 +48,16 @@ module GHC.Tc.Module (
import GHC.Prelude
+import GHC.Driver.Env
+import GHC.Driver.Plugins
+import GHC.Driver.Session
+
+import GHC.Tc.Errors.Hole.FitTypes ( HoleFitPluginR (..) )
import {-# SOURCE #-} GHC.Tc.Gen.Splice ( finishTH, runRemoteModFinalizers )
-import GHC.Rename.Splice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) )
-import GHC.Iface.Env ( externaliseName )
import GHC.Tc.Gen.HsType
import GHC.Tc.Validity( checkValidType )
import GHC.Tc.Gen.Match
import GHC.Tc.Utils.Unify( checkConstraints )
-import GHC.Rename.HsType
-import GHC.Rename.Expr
-import GHC.Rename.Utils ( HsDocContext(..) )
-import GHC.Rename.Fixity ( lookupFixityRn )
-import GHC.Builtin.Types ( unitTy, mkListTy )
-import GHC.Driver.Plugins
-import GHC.Driver.Session
-import GHC.Hs
-import GHC.Iface.Syntax ( ShowSub(..), showToHeader )
-import GHC.Iface.Type ( ShowForAllFlag(..) )
-import GHC.Core.PatSyn ( pprPatSynType )
-import GHC.Core.Predicate ( classMethodTy )
-import GHC.Builtin.Names
-import GHC.Builtin.Utils
-import GHC.Types.Name.Reader
import GHC.Tc.Utils.Zonk
import GHC.Tc.Gen.Expr
import GHC.Tc.Errors( reportAllUnsolved )
@@ -79,24 +67,14 @@ import GHC.Tc.Gen.Export
import GHC.Tc.Types.Evidence
import GHC.Tc.Types.Constraint
import GHC.Tc.Types.Origin
-import qualified GHC.Data.BooleanFormula as BF
-import GHC.Core.Ppr.TyThing ( pprTyThingInContext )
-import GHC.Core.FVs ( orphNamesOfFamInst )
import GHC.Tc.Instance.Family
-import GHC.Core.InstEnv
-import GHC.Core.FamInstEnv
- ( FamInst, pprFamInst, famInstsRepTyCons
- , famInstEnvElts, extendFamInstEnvList, normaliseType )
import GHC.Tc.Gen.Annotation
import GHC.Tc.Gen.Bind
-import GHC.Iface.Make ( coAxiomToIfaceDecl )
-import GHC.Parser.Header ( mkPrelImports )
import GHC.Tc.Gen.Default
import GHC.Tc.Utils.Env
import GHC.Tc.Gen.Rule
import GHC.Tc.Gen.Foreign
import GHC.Tc.TyCl.Instance
-import GHC.IfaceToCore
import GHC.Tc.Utils.TcMType
import GHC.Tc.Utils.TcType
import GHC.Tc.Utils.Instantiate (tcGetInsts)
@@ -104,50 +82,97 @@ import GHC.Tc.Solver
import GHC.Tc.TyCl
import GHC.Tc.Instance.Typeable ( mkTypeableBinds )
import GHC.Tc.Utils.Backpack
-import GHC.Iface.Load
+
+import GHC.Rename.Splice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) )
+import GHC.Rename.HsType
+import GHC.Rename.Expr
+import GHC.Rename.Utils ( HsDocContext(..) )
+import GHC.Rename.Fixity ( lookupFixityRn )
import GHC.Rename.Names
import GHC.Rename.Env
import GHC.Rename.Module
+
+import GHC.Iface.Syntax ( ShowSub(..), showToHeader )
+import GHC.Iface.Type ( ShowForAllFlag(..) )
+import GHC.Iface.Env ( externaliseName )
+import GHC.Iface.Make ( coAxiomToIfaceDecl )
+import GHC.Iface.Load
+
+import GHC.Builtin.Types ( unitTy, mkListTy )
+import GHC.Builtin.Names
+import GHC.Builtin.Utils
+
+import GHC.Hs
+import GHC.Hs.Dump
+
+import GHC.Core.PatSyn ( pprPatSynType )
+import GHC.Core.Predicate ( classMethodTy )
+import GHC.Core.FVs ( orphNamesOfFamInst )
+import GHC.Core.InstEnv
+import GHC.Core.TyCon
+import GHC.Core.ConLike
+import GHC.Core.DataCon
+import GHC.Core.Type
+import GHC.Core.Class
+import GHC.Core.Coercion.Axiom
+import GHC.Core.FamInstEnv
+ ( FamInst, pprFamInst, famInstsRepTyCons
+ , famInstEnvElts, extendFamInstEnvList, normaliseType )
+
+import GHC.Parser.Header ( mkPrelImports )
+
+import GHC.IfaceToCore
+
+import GHC.Runtime.Context
+
import GHC.Utils.Error
+import GHC.Utils.Outputable as Outputable
+import GHC.Utils.Panic
+import GHC.Utils.Misc
+
+import GHC.Types.Name.Reader
+import GHC.Types.Fixity.Env
import GHC.Types.Id as Id
import GHC.Types.Id.Info( IdDetails(..) )
import GHC.Types.Var.Env
-import GHC.Unit
+import GHC.Types.TypeEnv
import GHC.Types.Unique.FM
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Name.Set
import GHC.Types.Avail
-import GHC.Core.TyCon
-import GHC.Types.SrcLoc
-import GHC.Driver.Types
-import GHC.Data.List.SetOps
-import GHC.Utils.Outputable as Outputable
-import GHC.Utils.Panic
-import GHC.Core.ConLike
-import GHC.Core.DataCon
-import GHC.Core.Type
-import GHC.Core.Class
import GHC.Types.Basic hiding( SuccessFlag(..) )
-import GHC.Core.Coercion.Axiom
import GHC.Types.Annotations
-import Data.List ( find, sortBy, sort )
-import Data.Ord
+import GHC.Types.SrcLoc
+import GHC.Types.SourceText
+import GHC.Types.SourceFile
+import GHC.Types.TyThing.Ppr ( pprTyThingInContext )
+import qualified GHC.LanguageExtensions as LangExt
+
+import GHC.Unit.External
+import GHC.Unit.Types
+import GHC.Unit.State
+import GHC.Unit.Home
+import GHC.Unit.Module
+import GHC.Unit.Module.Warnings
+import GHC.Unit.Module.ModSummary
+import GHC.Unit.Module.ModIface
+import GHC.Unit.Module.ModDetails
+import GHC.Unit.Module.Deps
+
import GHC.Data.FastString
import GHC.Data.Maybe
-import GHC.Utils.Misc
+import GHC.Data.List.SetOps
import GHC.Data.Bag
-import qualified GHC.LanguageExtensions as LangExt
+import qualified GHC.Data.BooleanFormula as BF
+
+import Data.List ( find, sortBy, sort )
+import Data.Ord
import Data.Data ( Data )
-import GHC.Hs.Dump
import qualified Data.Set as S
-
import Control.DeepSeq
import Control.Monad
-import GHC.Tc.Errors.Hole.FitTypes ( HoleFitPluginR (..) )
-
-
#include "HsVersions.h"
{-
@@ -2099,7 +2124,7 @@ tcRnStmt hsc_env rdr_stmt
traceTc "tcs 1" empty ;
this_mod <- getModule ;
global_ids <- mapM (externaliseAndTidyId this_mod) zonked_ids ;
- -- Note [Interactively-bound Ids in GHCi] in GHC.Driver.Types
+ -- Note [Interactively-bound Ids in GHCi] in GHC.Driver.Env
{- ---------------------------------------------
At one stage I removed any shadowed bindings from the type_env;
@@ -2170,7 +2195,7 @@ runPlans (p:ps) = tryTcDiscardingErrs (runPlans ps) p
--
-- By 'lift' and 'environment we mean that the code is changed to
-- execute properly in an IO monad. See Note [Interactively-bound Ids
--- in GHCi] in GHC.Driver.Types for more details. We do this lifting by trying
+-- in GHCi] in GHC.Driver.Env for more details. We do this lifting by trying
-- different ways ('plans') of lifting the code into the IO monad and
-- type checking each plan until one succeeds.
tcUserStmt :: GhciLStmt GhcPs -> TcM (PlanResult, FixityEnv)
diff --git a/compiler/GHC/Tc/Module.hs-boot b/compiler/GHC/Tc/Module.hs-boot
index 90d775a4e2..2748c769e4 100644
--- a/compiler/GHC/Tc/Module.hs-boot
+++ b/compiler/GHC/Tc/Module.hs-boot
@@ -1,7 +1,7 @@
module GHC.Tc.Module where
import GHC.Prelude
-import GHC.Core.Type(TyThing)
+import GHC.Types.TyThing(TyThing)
import GHC.Tc.Types (TcM)
import GHC.Utils.Outputable (SDoc)
import GHC.Types.Name (Name)
diff --git a/compiler/GHC/Tc/Plugin.hs b/compiler/GHC/Tc/Plugin.hs
index db9c3a1b81..b27168a1fc 100644
--- a/compiler/GHC/Tc/Plugin.hs
+++ b/compiler/GHC/Tc/Plugin.hs
@@ -10,7 +10,7 @@ module GHC.Tc.Plugin (
unsafeTcPluginTcM,
-- * Finding Modules and Names
- FindResult(..),
+ Finder.FindResult(..),
findImportedModule,
lookupOrig,
@@ -52,13 +52,13 @@ module GHC.Tc.Plugin (
import GHC.Prelude
-import qualified GHC.Tc.Utils.Monad as TcM
+import qualified GHC.Tc.Utils.Monad as TcM
import qualified GHC.Tc.Solver.Monad as TcS
-import qualified GHC.Tc.Utils.Env as TcM
+import qualified GHC.Tc.Utils.Env as TcM
import qualified GHC.Tc.Utils.TcMType as TcM
import qualified GHC.Tc.Instance.Family as TcM
import qualified GHC.Iface.Env as IfaceEnv
-import qualified GHC.Driver.Finder as Finder
+import qualified GHC.Unit.Finder as Finder
import GHC.Core.FamInstEnv ( FamInstEnv )
import GHC.Tc.Utils.Monad ( TcGblEnv, TcLclEnv, TcPluginM
@@ -73,10 +73,11 @@ import GHC.Types.Var ( EvVar )
import GHC.Unit.Module
import GHC.Types.Name
+import GHC.Types.TyThing
import GHC.Core.TyCon
import GHC.Core.DataCon
import GHC.Core.Class
-import GHC.Driver.Types
+import GHC.Driver.Env
import GHC.Utils.Outputable
import GHC.Core.Type
import GHC.Core.Coercion ( BlockSubstFlag(..) )
@@ -95,7 +96,7 @@ tcPluginTrace :: String -> SDoc -> TcPluginM ()
tcPluginTrace a b = unsafeTcPluginTcM (traceTc a b)
-findImportedModule :: ModuleName -> Maybe FastString -> TcPluginM FindResult
+findImportedModule :: ModuleName -> Maybe FastString -> TcPluginM Finder.FindResult
findImportedModule mod_name mb_pkg = do
hsc_env <- getTopEnv
tcPluginIO $ Finder.findImportedModule hsc_env mod_name mb_pkg
diff --git a/compiler/GHC/Tc/Solver/Monad.hs b/compiler/GHC/Tc/Solver/Monad.hs
index 4c20eed977..1d8ccb7933 100644
--- a/compiler/GHC/Tc/Solver/Monad.hs
+++ b/compiler/GHC/Tc/Solver/Monad.hs
@@ -129,7 +129,7 @@ module GHC.Tc.Solver.Monad (
import GHC.Prelude
-import GHC.Driver.Types
+import GHC.Driver.Env
import qualified GHC.Tc.Utils.Instantiate as TcM
import GHC.Core.InstEnv
@@ -155,6 +155,7 @@ import GHC.Core.TyCon
import GHC.Tc.Errors ( solverDepthErrorTcS )
import GHC.Types.Name
+import GHC.Types.TyThing
import GHC.Unit.Module ( HasModule, getModule )
import GHC.Types.Name.Reader ( GlobalRdrEnv, GlobalRdrElt )
import qualified GHC.Rename.Env as TcM
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index bd47bf7bd9..ae30b9d870 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -28,8 +28,11 @@ module GHC.Tc.TyCl (
import GHC.Prelude
+import GHC.Driver.Env
+import GHC.Driver.Session
+
import GHC.Hs
-import GHC.Driver.Types
+
import GHC.Tc.TyCl.Build
import GHC.Tc.Solver( pushLevelAndSolveEqualities, pushLevelAndSolveEqualitiesX
, reportUnsolvedEqualities )
@@ -44,14 +47,17 @@ import GHC.Tc.Deriv (DerivInfo(..))
import GHC.Tc.Gen.HsType
import GHC.Tc.Instance.Class( AssocInstInfo(..) )
import GHC.Tc.Utils.TcMType
-import GHC.Builtin.Types (oneDataConTy, unitTy, makeRecoveryTyCon )
import GHC.Tc.Utils.TcType
-import GHC.Core.Multiplicity
-import GHC.Rename.Env( lookupConstructorFields )
import GHC.Tc.Instance.Family
+import GHC.Tc.Types.Origin
+
+import GHC.Builtin.Types (oneDataConTy, unitTy, makeRecoveryTyCon )
+
+import GHC.Rename.Env( lookupConstructorFields )
+
+import GHC.Core.Multiplicity
import GHC.Core.FamInstEnv
import GHC.Core.Coercion
-import GHC.Tc.Types.Origin
import GHC.Core.Type
import GHC.Core.TyCo.Rep -- for checkValidRoles
import GHC.Core.TyCo.Ppr( pprTyVars )
@@ -59,27 +65,31 @@ import GHC.Core.Class
import GHC.Core.Coercion.Axiom
import GHC.Core.TyCon
import GHC.Core.DataCon
+import GHC.Core.Unify
+
import GHC.Types.Id
import GHC.Types.Var
import GHC.Types.Var.Env
import GHC.Types.Var.Set
-import GHC.Data.FastString
-import GHC.Unit
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.Name.Env
-import GHC.Utils.Outputable
-import GHC.Utils.Panic
-import GHC.Data.Maybe
-import GHC.Core.Unify
-import GHC.Utils.Misc
import GHC.Types.SrcLoc
-import GHC.Data.List.SetOps
-import GHC.Driver.Session
+import GHC.Types.SourceFile
import GHC.Types.Unique
import GHC.Types.Basic
import qualified GHC.LanguageExtensions as LangExt
+import GHC.Data.FastString
+import GHC.Data.Maybe
+import GHC.Data.List.SetOps
+
+import GHC.Unit
+
+import GHC.Utils.Outputable
+import GHC.Utils.Panic
+import GHC.Utils.Misc
+
import Control.Monad
import Data.Function ( on )
import Data.Functor.Identity
diff --git a/compiler/GHC/Tc/TyCl/Build.hs b/compiler/GHC/Tc/TyCl/Build.hs
index 93f5eedb50..52a5592d67 100644
--- a/compiler/GHC/Tc/TyCl/Build.hs
+++ b/compiler/GHC/Tc/TyCl/Build.hs
@@ -34,6 +34,7 @@ import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Core.Type
import GHC.Types.Id
+import GHC.Types.SourceText
import GHC.Tc.Utils.TcType
import GHC.Core.Multiplicity
diff --git a/compiler/GHC/Tc/TyCl/Class.hs b/compiler/GHC/Tc/TyCl/Class.hs
index baad1622c0..92be85fa06 100644
--- a/compiler/GHC/Tc/TyCl/Class.hs
+++ b/compiler/GHC/Tc/TyCl/Class.hs
@@ -45,7 +45,6 @@ import GHC.Core.Multiplicity
import GHC.Tc.Types.Origin
import GHC.Tc.Utils.TcType
import GHC.Tc.Utils.Monad
-import GHC.Driver.Phases (HscSource(..))
import GHC.Tc.TyCl.Build( TcMethInfo )
import GHC.Core.Class
import GHC.Core.Coercion ( pprCoAxiom )
@@ -58,6 +57,7 @@ import GHC.Types.Name.Env
import GHC.Types.Name.Set
import GHC.Types.Var
import GHC.Types.Var.Env
+import GHC.Types.SourceFile (HscSource(..))
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Types.SrcLoc
diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index 4cc8a79e1e..cc47d1e348 100644
--- a/compiler/GHC/Tc/TyCl/Instance.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -67,11 +67,13 @@ import GHC.Types.Var.Env
import GHC.Types.Var.Set
import GHC.Data.Bag
import GHC.Types.Basic
+import GHC.Types.Fixity
import GHC.Driver.Session
import GHC.Driver.Ppr
import GHC.Utils.Error
import GHC.Data.FastString
import GHC.Types.Id
+import GHC.Types.SourceText
import GHC.Data.List.SetOps
import GHC.Types.Name
import GHC.Types.Name.Set
diff --git a/compiler/GHC/Tc/TyCl/Utils.hs b/compiler/GHC/Tc/TyCl/Utils.hs
index a225fbdd6d..8755fbf762 100644
--- a/compiler/GHC/Tc/TyCl/Utils.hs
+++ b/compiler/GHC/Tc/TyCl/Utils.hs
@@ -34,40 +34,49 @@ import GHC.Prelude
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Env
import GHC.Tc.Gen.Bind( tcValBinds )
+import GHC.Tc.Utils.TcType
+
+import GHC.Builtin.Types( unitTy )
+import GHC.Builtin.Uniques ( mkBuiltinUnique )
+
+import GHC.Hs
+
import GHC.Core.TyCo.Rep( Type(..), Coercion(..), MCoercion(..), UnivCoProvenance(..) )
import GHC.Core.Multiplicity
-import GHC.Tc.Utils.TcType
import GHC.Core.Predicate
-import GHC.Builtin.Types( unitTy )
import GHC.Core.Make( rEC_SEL_ERROR_ID )
-import GHC.Hs
import GHC.Core.Class
import GHC.Core.Type
-import GHC.Driver.Types
import GHC.Core.TyCon
import GHC.Core.ConLike
import GHC.Core.DataCon
-import GHC.Types.Name
-import GHC.Types.Name.Env
-import GHC.Types.Name.Reader ( mkVarUnqual )
-import GHC.Types.Id
-import GHC.Types.Id.Info
-import GHC.Types.Var.Env
-import GHC.Types.Var.Set
-import GHC.Types.Unique.Set
import GHC.Core.TyCon.Set
import GHC.Core.Coercion ( ltRole )
-import GHC.Types.Basic
-import GHC.Types.SrcLoc
-import GHC.Builtin.Uniques ( mkBuiltinUnique )
+
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc
+import GHC.Utils.FV as FV
+
import GHC.Data.Maybe
import GHC.Data.Bag
import GHC.Data.FastString
-import GHC.Utils.FV as FV
+
import GHC.Unit.Module
+
+import GHC.Types.Basic
+import GHC.Types.SrcLoc
+import GHC.Types.SourceFile
+import GHC.Types.SourceText
+import GHC.Types.Name
+import GHC.Types.Name.Env
+import GHC.Types.Name.Reader ( mkVarUnqual )
+import GHC.Types.Id
+import GHC.Types.Id.Info
+import GHC.Types.Var.Env
+import GHC.Types.Var.Set
+import GHC.Types.Unique.Set
+import GHC.Types.TyThing
import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
diff --git a/compiler/GHC/Tc/Types.hs b/compiler/GHC/Tc/Types.hs
index 24b4905399..3cda5de56f 100644
--- a/compiler/GHC/Tc/Types.hs
+++ b/compiler/GHC/Tc/Types.hs
@@ -87,23 +87,30 @@ module GHC.Tc.Types(
import GHC.Prelude
import GHC.Platform
+import GHC.Driver.Env
+import GHC.Driver.Session
+
import GHC.Hs
-import GHC.Driver.Types
+
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Origin
import GHC.Tc.Types.Evidence
+import {-# SOURCE #-} GHC.Tc.Errors.Hole.FitTypes ( HoleFitPlugin )
+
import GHC.Core.Type
import GHC.Core.TyCon ( TyCon, tyConKind )
import GHC.Core.PatSyn ( PatSyn )
import GHC.Core.Lint ( lintAxioms )
-import GHC.Types.Id ( idType, idName )
-import GHC.Types.FieldLabel ( FieldLabel )
import GHC.Core.UsageEnv
-import GHC.Tc.Utils.TcType
-import GHC.Tc.Types.Constraint
-import GHC.Tc.Types.Origin
-import GHC.Types.Annotations
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
-import GHC.Data.IOEnv
+
+import GHC.Types.Id ( idType, idName )
+import GHC.Types.FieldLabel ( FieldLabel )
+import GHC.Types.Fixity.Env
+import GHC.Types.Annotations
+import GHC.Types.CompleteMatch
import GHC.Types.Name.Reader
import GHC.Types.Name
import GHC.Types.Name.Env
@@ -111,26 +118,36 @@ import GHC.Types.Name.Set
import GHC.Types.Avail
import GHC.Types.Var
import GHC.Types.Var.Env
-import GHC.Unit
+import GHC.Types.TypeEnv
+import GHC.Types.TyThing
+import GHC.Types.SourceFile
import GHC.Types.SrcLoc
import GHC.Types.Var.Set
-import GHC.Utils.Error
import GHC.Types.Unique.FM
import GHC.Types.Basic
+import GHC.Types.CostCentre.State
+import GHC.Types.HpcInfo
+
+import GHC.Data.IOEnv
import GHC.Data.Bag
-import GHC.Driver.Session
-import GHC.Utils.Outputable
import GHC.Data.List.SetOps
+
+import GHC.Unit
+import GHC.Unit.Module.Warnings
+import GHC.Unit.Module.Imported
+import GHC.Unit.Module.ModDetails
+
+import GHC.Utils.Error
+import GHC.Utils.Outputable
import GHC.Utils.Fingerprint
import GHC.Utils.Misc
import GHC.Utils.Panic
+
import GHC.Builtin.Names ( isUnboundName )
-import GHC.Types.CostCentre.State
import Control.Monad (ap)
import Data.Set ( Set )
import qualified Data.Set as S
-
import Data.List ( sort )
import Data.Map ( Map )
import Data.Dynamic ( Dynamic )
@@ -139,8 +156,6 @@ import Data.Maybe ( mapMaybe )
import GHCi.Message
import GHCi.RemoteTypes
-import {-# SOURCE #-} GHC.Tc.Errors.Hole.FitTypes ( HoleFitPlugin )
-
import qualified Language.Haskell.TH as TH
-- | A 'NameShape' is a substitution on 'Name's that can be used
@@ -297,7 +312,7 @@ data IfLclEnv
-- module. Currently one always gets a 'FrontendTypecheck', since running the
-- frontend involves typechecking a program. hs-sig merges are not handled here.
--
--- This data type really should be in GHC.Driver.Types, but it needs
+-- This data type really should be in GHC.Driver.Env, but it needs
-- to have a TcGblEnv which is only defined here.
data FrontendResult
= FrontendTypecheck TcGblEnv
@@ -367,7 +382,7 @@ data TcGblEnv
tcg_fix_env :: FixityEnv, -- ^ Just for things in this module
tcg_field_env :: RecFieldEnv, -- ^ Just for things in this module
- -- See Note [The interactive package] in "GHC.Driver.Types"
+ -- See Note [The interactive package] in "GHC.Runtime.Context"
tcg_type_env :: TypeEnv,
-- ^ Global type env for the module we are compiling now. All
@@ -378,7 +393,7 @@ data TcGblEnv
-- move to the global envt during zonking)
--
-- NB: for what "things in this module" means, see
- -- Note [The interactive package] in "GHC.Driver.Types"
+ -- Note [The interactive package] in "GHC.Runtime.Context"
tcg_type_env_var :: TcRef TypeEnv,
-- Used only to initialise the interface-file
@@ -501,7 +516,8 @@ data TcGblEnv
-- Things defined in this module, or (in GHCi)
-- in the declarations for a single GHCi command.
- -- For the latter, see Note [The interactive package] in GHC.Driver.Types
+ -- For the latter, see Note [The interactive package] in
+ -- GHC.Runtime.Context
tcg_tr_module :: Maybe Id, -- Id for $trModule :: GHC.Unit.Module
-- for which every module has a top-level defn
-- except in GHCi in which case we have Nothing
@@ -1285,8 +1301,8 @@ data ImportAvails
-- = ModuleEnv [ImportedModsVal],
-- ^ Domain is all directly-imported modules
--
- -- See the documentation on ImportedModsVal in "GHC.Driver.Types" for the
- -- meaning of the fields.
+ -- See the documentation on ImportedModsVal in
+ -- "GHC.Unit.Module.Imported" for the meaning of the fields.
--
-- We need a full ModuleEnv rather than a ModuleNameEnv here,
-- because we might be importing modules of the same name from
diff --git a/compiler/GHC/Tc/Types/EvTerm.hs b/compiler/GHC/Tc/Types/EvTerm.hs
index 61738f431e..d1a0f56531 100644
--- a/compiler/GHC/Tc/Types/EvTerm.hs
+++ b/compiler/GHC/Tc/Types/EvTerm.hs
@@ -6,19 +6,25 @@ where
import GHC.Prelude
-import GHC.Data.FastString
+import GHC.Driver.Session
+
+import GHC.Tc.Types.Evidence
+
+import GHC.Unit
+
+import GHC.Builtin.Names
+
import GHC.Core.Type
import GHC.Core
import GHC.Core.Make
-import GHC.Types.Literal ( Literal(..) )
-import GHC.Tc.Types.Evidence
-import GHC.Driver.Types
-import GHC.Driver.Session
-import GHC.Types.Name
-import GHC.Unit
import GHC.Core.Utils
-import GHC.Builtin.Names
+
+import GHC.Types.Literal ( Literal(..) )
import GHC.Types.SrcLoc
+import GHC.Types.Name
+import GHC.Types.TyThing
+
+import GHC.Data.FastString
-- Used with Opt_DeferTypeErrors
-- See Note [Deferring coercion errors to runtime]
diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs
index 7919f8cc4c..ecdc4ae624 100644
--- a/compiler/GHC/Tc/Utils/Backpack.hs
+++ b/compiler/GHC/Tc/Utils/Backpack.hs
@@ -18,57 +18,75 @@ module GHC.Tc.Utils.Backpack (
import GHC.Prelude
-import GHC.Types.Basic (defaultFixity, TypeOrKind(..))
-import GHC.Unit
-import GHC.Tc.Gen.Export
+import GHC.Driver.Env
import GHC.Driver.Session
import GHC.Driver.Ppr
-import GHC.Hs
+
+import GHC.Types.Basic (TypeOrKind(..))
+import GHC.Types.Fixity (defaultFixity)
+import GHC.Types.Fixity.Env
+import GHC.Types.TypeEnv
import GHC.Types.Name.Reader
-import GHC.Tc.Utils.Monad
+import GHC.Types.Id
+import GHC.Types.Name
+import GHC.Types.Name.Env
+import GHC.Types.Name.Set
+import GHC.Types.Avail
+import GHC.Types.SrcLoc
+import GHC.Types.SourceFile
+import GHC.Types.Var
+import GHC.Types.Unique.DSet
+import GHC.Types.Name.Shape
+
+import GHC.Unit
+import GHC.Unit.State
+import GHC.Unit.Finder
+import GHC.Unit.Module.Warnings
+import GHC.Unit.Module.ModIface
+import GHC.Unit.Module.ModDetails
+import GHC.Unit.Module.Imported
+import GHC.Unit.Module.Deps
+
+import GHC.Tc.Gen.Export
import GHC.Tc.TyCl.Utils
-import GHC.Core.InstEnv
-import GHC.Core.FamInstEnv
+import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Instantiate
-import GHC.IfaceToCore
import GHC.Tc.Utils.TcMType
import GHC.Tc.Utils.TcType
import GHC.Tc.Solver
import GHC.Tc.Types.Constraint
import GHC.Tc.Types.Origin
-import GHC.Iface.Load
-import GHC.Rename.Names
-import GHC.Utils.Error
-import GHC.Types.Id
-import GHC.Types.Name
-import GHC.Types.Name.Env
-import GHC.Types.Name.Set
-import GHC.Types.Avail
-import GHC.Types.SrcLoc
-import GHC.Driver.Types
-import GHC.Utils.Outputable
-import GHC.Utils.Panic
+
+import GHC.Hs
+
+import GHC.Core.InstEnv
+import GHC.Core.FamInstEnv
import GHC.Core.Type
import GHC.Core.Multiplicity
-import GHC.Data.FastString
-import GHC.Rename.Fixity ( lookupFixityRn )
-import GHC.Data.Maybe
-import GHC.Tc.Utils.Env
-import GHC.Types.Var
+
+import GHC.IfaceToCore
+import GHC.Iface.Load
+import GHC.Iface.Rename
import GHC.Iface.Syntax
-import qualified Data.Map as Map
-import GHC.Driver.Finder
-import GHC.Types.Unique.DSet
-import GHC.Types.Name.Shape
+import GHC.Rename.Names
+import GHC.Rename.Fixity ( lookupFixityRn )
+
+import GHC.Tc.Utils.Env
import GHC.Tc.Errors
import GHC.Tc.Utils.Unify
-import GHC.Iface.Rename
+
import GHC.Utils.Misc
-import GHC.Unit.State
+import GHC.Utils.Error
+import GHC.Utils.Outputable
+import GHC.Utils.Panic
+
+import GHC.Data.FastString
+import GHC.Data.Maybe
import Control.Monad
import Data.List (find)
+import qualified Data.Map as Map
import {-# SOURCE #-} GHC.Tc.Module
diff --git a/compiler/GHC/Tc/Utils/Env.hs b/compiler/GHC/Tc/Utils/Env.hs
index 2bcc8af641..7755d3370d 100644
--- a/compiler/GHC/Tc/Utils/Env.hs
+++ b/compiler/GHC/Tc/Utils/Env.hs
@@ -74,21 +74,27 @@ module GHC.Tc.Utils.Env(
import GHC.Prelude
+import GHC.Driver.Env
+import GHC.Driver.Session
+
+import GHC.Builtin.Names
+import GHC.Builtin.Types
+
+import GHC.Runtime.Context
+
import GHC.Hs
+
import GHC.Iface.Env
+import GHC.Iface.Load
+
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.TcMType
import GHC.Tc.Utils.TcType
-import GHC.Core.UsageEnv
import GHC.Tc.Types.Evidence (HsWrapper, idHsWrapper)
import {-# SOURCE #-} GHC.Tc.Utils.Unify ( tcSubMult )
import GHC.Tc.Types.Origin ( CtOrigin(UsageEnvironmentOf) )
-import GHC.Iface.Load
-import GHC.Builtin.Names
-import GHC.Builtin.Types
-import GHC.Types.Id
-import GHC.Types.Var
-import GHC.Types.Name.Reader
+
+import GHC.Core.UsageEnv
import GHC.Core.InstEnv
import GHC.Core.DataCon ( DataCon )
import GHC.Core.PatSyn ( PatSyn )
@@ -97,26 +103,35 @@ import GHC.Core.TyCon
import GHC.Core.Type
import GHC.Core.Coercion.Axiom
import GHC.Core.Class
-import GHC.Types.Name
-import GHC.Types.Name.Set
-import GHC.Types.Name.Env
-import GHC.Types.Var.Env
-import GHC.Driver.Types
-import GHC.Driver.Session
-import GHC.Types.SrcLoc
-import GHC.Types.Basic hiding( SuccessFlag(..) )
+
import GHC.Unit.Module
import GHC.Unit.Home
+import GHC.Unit.External
+
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Encoding
+import GHC.Utils.Error
+import GHC.Utils.Misc ( HasDebugCallStack )
+
import GHC.Data.FastString
import GHC.Data.Bag
import GHC.Data.List.SetOps
-import GHC.Utils.Error
import GHC.Data.Maybe( MaybeErr(..), orElse )
+
+import GHC.Types.SrcLoc
+import GHC.Types.Basic hiding( SuccessFlag(..) )
+import GHC.Types.TypeEnv
+import GHC.Types.SourceFile
+import GHC.Types.Name
+import GHC.Types.Name.Set
+import GHC.Types.Name.Env
+import GHC.Types.Id
+import GHC.Types.Var
+import GHC.Types.Var.Env
+import GHC.Types.Name.Reader
+import GHC.Types.TyThing
import qualified GHC.LanguageExtensions as LangExt
-import GHC.Utils.Misc ( HasDebugCallStack )
import Data.IORef
import Data.List (intercalate)
diff --git a/compiler/GHC/Tc/Utils/Instantiate.hs b/compiler/GHC/Tc/Utils/Instantiate.hs
index a47e913d17..5416e29692 100644
--- a/compiler/GHC/Tc/Utils/Instantiate.hs
+++ b/compiler/GHC/Tc/Utils/Instantiate.hs
@@ -41,47 +41,53 @@ module GHC.Tc.Utils.Instantiate (
import GHC.Prelude
-import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcCheckPolyExpr, tcSyntaxOp )
-import {-# SOURCE #-} GHC.Tc.Utils.Unify( unifyType, unifyKind )
+import GHC.Driver.Session
+
+import GHC.Builtin.Types ( heqDataCon, eqDataCon, integerTyConName )
+import GHC.Builtin.Names
-import GHC.Types.Basic ( IntegralLit(..), SourceText(..) )
import GHC.Hs
+
+import GHC.Core.InstEnv
+import GHC.Core.Predicate
+import GHC.Core ( isOrphan )
+import GHC.Core.Type
+import GHC.Core.Multiplicity
+import GHC.Core.TyCo.Rep
+import GHC.Core.TyCo.Ppr ( debugPprType )
+import GHC.Core.Class( Class )
+import GHC.Core( Expr(..) ) -- For the Coercion constructor
+import GHC.Core.DataCon
+
+import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcCheckPolyExpr, tcSyntaxOp )
+import {-# SOURCE #-} GHC.Tc.Utils.Unify( unifyType, unifyKind )
import GHC.Tc.Utils.Zonk
import GHC.Tc.Utils.Monad
import GHC.Tc.Types.Constraint
-import GHC.Core.Predicate
import GHC.Tc.Types.Origin
import GHC.Tc.Utils.Env
import GHC.Tc.Types.Evidence
-import GHC.Core.InstEnv
-import GHC.Builtin.Types ( heqDataCon, eqDataCon, integerTyConName )
-import GHC.Core ( isOrphan )
import GHC.Tc.Instance.FunDeps
import GHC.Tc.Utils.TcMType
-import GHC.Core.Type
-import GHC.Core.Multiplicity
-import GHC.Core.TyCo.Rep
-import GHC.Core.TyCo.Ppr ( debugPprType )
import GHC.Tc.Utils.TcType
-import GHC.Driver.Types
-import GHC.Core.Class( Class )
+
import GHC.Types.Id.Make( mkDictFunId )
-import GHC.Core( Expr(..) ) -- For the Coercion constructor
+import GHC.Types.Basic ( TypeOrKind(..) )
+import GHC.Types.SourceText
+import GHC.Types.SrcLoc as SrcLoc
+import GHC.Types.Var.Env
+import GHC.Types.Var.Set
import GHC.Types.Id
import GHC.Types.Name
import GHC.Types.Var
-import GHC.Core.DataCon
-import GHC.Types.Var.Env
-import GHC.Types.Var.Set
-import GHC.Builtin.Names
-import GHC.Types.SrcLoc as SrcLoc
-import GHC.Driver.Session
+import qualified GHC.LanguageExtensions as LangExt
+
import GHC.Utils.Misc
import GHC.Utils.Panic
import GHC.Utils.Outputable
-import GHC.Types.Basic ( TypeOrKind(..) )
-import qualified GHC.LanguageExtensions as LangExt
+
import GHC.Unit.State
+import GHC.Unit.External
import Data.List ( sortBy, mapAccumL )
import Control.Monad( unless )
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 9910101424..e42fe42799 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -151,47 +151,61 @@ module GHC.Tc.Utils.Monad(
import GHC.Prelude
-import GHC.Driver.Ppr
+
+import GHC.Builtin.Names
import GHC.Tc.Types -- Re-export all
-import GHC.Data.IOEnv -- Re-export all
import GHC.Tc.Types.Constraint
import GHC.Tc.Types.Evidence
import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcType
import GHC.Hs hiding (LIE)
-import GHC.Driver.Types
+
import GHC.Unit
-import GHC.Types.Name.Reader
-import GHC.Types.Name
+import GHC.Unit.External
+import GHC.Unit.Module.Warnings
+import GHC.Unit.Home.ModInfo
+
import GHC.Core.UsageEnv
import GHC.Core.Multiplicity
-import GHC.Core.Type
-
-import GHC.Tc.Utils.TcType
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
-import GHC.Builtin.Names
+import GHC.Driver.Env
+import GHC.Driver.Ppr
+import GHC.Driver.Session
+
+import GHC.Runtime.Context
+
+import GHC.Data.IOEnv -- Re-export all
+import GHC.Data.Bag
+import GHC.Data.FastString
+import GHC.Data.Maybe
+
+import GHC.Utils.Outputable as Outputable
+import GHC.Utils.Error
+import GHC.Utils.Panic
+import GHC.Utils.Misc
+
+import GHC.Types.Fixity.Env
+import GHC.Types.Name.Reader
+import GHC.Types.Name
+import GHC.Types.SafeHaskell
import GHC.Types.Id
+import GHC.Types.TypeEnv
import GHC.Types.Var.Set
import GHC.Types.Var.Env
-import GHC.Utils.Error
import GHC.Types.SrcLoc
import GHC.Types.Name.Env
import GHC.Types.Name.Set
-import GHC.Data.Bag
-import GHC.Utils.Outputable as Outputable
+import GHC.Types.Name.Ppr
import GHC.Types.Unique (uniqFromMask)
import GHC.Types.Unique.Supply
-import GHC.Driver.Session
-import GHC.Data.FastString
-import GHC.Utils.Panic
-import GHC.Utils.Misc
import GHC.Types.Annotations
import GHC.Types.Basic( TopLevelFlag, TypeOrKind(..) )
-import GHC.Data.Maybe
import GHC.Types.CostCentre.State
+import GHC.Types.SourceFile
import qualified GHC.LanguageExtensions as LangExt
diff --git a/compiler/GHC/Tc/Utils/TcType.hs b/compiler/GHC/Tc/Utils/TcType.hs
index 54258c7e52..412fc5aa43 100644
--- a/compiler/GHC/Tc/Utils/TcType.hs
+++ b/compiler/GHC/Tc/Utils/TcType.hs
@@ -182,7 +182,7 @@ module GHC.Tc.Utils.TcType (
--------------------------------
pprKind, pprParendKind, pprSigmaType,
- pprType, pprParendType, pprTypeApp, pprTyThingCategory, tyThingCategory,
+ pprType, pprParendType, pprTypeApp,
pprTheta, pprParendTheta, pprThetaArrowTy, pprClassPred,
pprTCvBndr, pprTCvBndrs,
diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs
index a47b75adc2..85587c29f8 100644
--- a/compiler/GHC/Tc/Utils/Zonk.hs
+++ b/compiler/GHC/Tc/Utils/Zonk.hs
@@ -47,43 +47,52 @@ module GHC.Tc.Utils.Zonk (
import GHC.Prelude
+import GHC.Platform
+
+import GHC.Builtin.Types
+import GHC.Builtin.Types.Prim
+import GHC.Builtin.Names
+
import GHC.Hs
-import GHC.Types.Id
-import GHC.Types.Id.Info
-import GHC.Core.Predicate
+
+import {-# SOURCE #-} GHC.Tc.Gen.Splice (runTopSplice)
import GHC.Tc.Utils.Monad
-import GHC.Builtin.Names
import GHC.Tc.TyCl.Build ( TcMethInfo, MethInfo )
import GHC.Tc.Utils.TcType
import GHC.Tc.Utils.TcMType
import GHC.Tc.Utils.Env ( tcLookupGlobalOnly )
import GHC.Tc.Types.Evidence
+
import GHC.Core.TyCo.Ppr ( pprTyVar )
-import GHC.Builtin.Types.Prim
import GHC.Core.TyCon
-import GHC.Builtin.Types
import GHC.Core.Type
import GHC.Core.Coercion
import GHC.Core.ConLike
import GHC.Core.DataCon
-import GHC.Driver.Types
+
+import GHC.Utils.Outputable
+import GHC.Utils.Misc
+import GHC.Utils.Panic
+
+import GHC.Core.Multiplicity
+import GHC.Core
+import GHC.Core.Predicate
+
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Var
import GHC.Types.Var.Env
-import GHC.Platform
+import GHC.Types.Id
+import GHC.Types.Id.Info
+import GHC.Types.TypeEnv
+import GHC.Types.SourceText
import GHC.Types.Basic
-import GHC.Data.Maybe
import GHC.Types.SrcLoc
-import GHC.Data.Bag
-import GHC.Utils.Outputable
-import GHC.Utils.Misc
-import GHC.Utils.Panic
import GHC.Types.Unique.FM
-import GHC.Core.Multiplicity
-import GHC.Core
+import GHC.Types.TyThing
-import {-# SOURCE #-} GHC.Tc.Gen.Splice (runTopSplice)
+import GHC.Data.Maybe
+import GHC.Data.Bag
import Control.Monad
import Data.List ( partition )