summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-10-31 22:40:07 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-03 23:08:09 -0400
commit311251543f2e37af4a121e58028bfc46267a7fc9 (patch)
treeacca98e59a64df33ef7273b374264eaed86737e1
parent634da448dd9296297eeb98f9552bc256b373a6f5 (diff)
downloadhaskell-311251543f2e37af4a121e58028bfc46267a7fc9.tar.gz
Export pprTrace and friends from GHC.Prelude.
Introduces GHC.Prelude.Basic which can be used in modules which are a dependency of the ppr code.
-rw-r--r--compiler/GHC/Cmm/Expr.hs1
-rw-r--r--compiler/GHC/CmmToAsm/BlockLayout.hs1
-rw-r--r--compiler/GHC/CmmToC.hs1
-rw-r--r--compiler/GHC/Core/Coercion/Opt.hs1
-rw-r--r--compiler/GHC/Core/Lint.hs1
-rw-r--r--compiler/GHC/Core/Opt/Arity.hs1
-rw-r--r--compiler/GHC/Core/Opt/ConstantFold.hs1
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs2
-rw-r--r--compiler/GHC/Core/Opt/OccurAnal.hs1
-rw-r--r--compiler/GHC/Core/Opt/SetLevels.hs1
-rw-r--r--compiler/GHC/Core/Opt/Simplify.hs1
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Iteration.hs1
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Utils.hs1
-rw-r--r--compiler/GHC/Core/Opt/SpecConstr.hs1
-rw-r--r--compiler/GHC/Core/Opt/Specialise.hs1
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap.hs1
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap/Utils.hs1
-rw-r--r--compiler/GHC/Core/Rules.hs1
-rw-r--r--compiler/GHC/Core/Tidy.hs1
-rw-r--r--compiler/GHC/Core/Utils.hs1
-rw-r--r--compiler/GHC/CoreToIface.hs1
-rw-r--r--compiler/GHC/CoreToStg.hs1
-rw-r--r--compiler/GHC/CoreToStg/Prep.hs1
-rw-r--r--compiler/GHC/Data/Bool.hs2
-rw-r--r--compiler/GHC/Data/FastMutInt.hs2
-rw-r--r--compiler/GHC/Data/FastString.hs2
-rw-r--r--compiler/GHC/Data/List/SetOps.hs1
-rw-r--r--compiler/GHC/Driver/Config/StgToCmm.hs5
-rw-r--r--compiler/GHC/Driver/Env.hs1
-rw-r--r--compiler/GHC/HsToCore/Binds.hs1
-rw-r--r--compiler/GHC/HsToCore/Pmc/Solver.hs3
-rw-r--r--compiler/GHC/Iface/Load.hs1
-rw-r--r--compiler/GHC/Iface/Make.hs1
-rw-r--r--compiler/GHC/Iface/Recomp.hs1
-rw-r--r--compiler/GHC/Iface/Tidy.hs1
-rw-r--r--compiler/GHC/Prelude.hs60
-rw-r--r--compiler/GHC/Prelude/Basic.hs104
-rw-r--r--compiler/GHC/Rename/Names.hs1
-rw-r--r--compiler/GHC/Runtime/Eval.hs1
-rw-r--r--compiler/GHC/Stg/InferTags/Rewrite.hs3
-rw-r--r--compiler/GHC/Stg/Subst.hs1
-rw-r--r--compiler/GHC/StgToCmm/Ticky.hs1
-rw-r--r--compiler/GHC/Tc/Errors/Hole.hs1
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs1
-rw-r--r--compiler/GHC/Tc/Utils/TcMType.hs1
-rw-r--r--compiler/GHC/Types/Demand.hs3
-rw-r--r--compiler/GHC/Types/Id.hs1
-rw-r--r--compiler/GHC/Types/Name/Occurrence.hs-boot2
-rw-r--r--compiler/GHC/Types/TyThing/Ppr.hs1
-rw-r--r--compiler/GHC/Unit/Types.hs1
-rw-r--r--compiler/GHC/Unit/Types.hs-boot2
-rw-r--r--compiler/GHC/Utils/BufHandle.hs2
-rw-r--r--compiler/GHC/Utils/Constants.hs2
-rw-r--r--compiler/GHC/Utils/Exception.hs2
-rw-r--r--compiler/GHC/Utils/Fingerprint.hs2
-rw-r--r--compiler/GHC/Utils/GlobalVars.hs2
-rw-r--r--compiler/GHC/Utils/IO/Unsafe.hs2
-rw-r--r--compiler/GHC/Utils/Misc.hs2
-rw-r--r--compiler/GHC/Utils/Outputable.hs2
-rw-r--r--compiler/GHC/Utils/Panic.hs2
-rw-r--r--compiler/GHC/Utils/Panic/Plain.hs2
-rw-r--r--compiler/GHC/Utils/Ppr.hs2
-rw-r--r--compiler/GHC/Utils/Ppr/Colour.hs2
-rw-r--r--compiler/GHC/Utils/Trace.hs13
-rw-r--r--compiler/Setup.hs2
-rw-r--r--compiler/ghc.cabal.in1
-rw-r--r--hadrian/src/Rules/Generate.hs2
-rw-r--r--testsuite/tests/count-deps/CountDepsAst.stdout1
-rw-r--r--testsuite/tests/count-deps/CountDepsParser.stdout1
69 files changed, 146 insertions, 127 deletions
diff --git a/compiler/GHC/Cmm/Expr.hs b/compiler/GHC/Cmm/Expr.hs
index 212316b68d..ccbb7f18ce 100644
--- a/compiler/GHC/Cmm/Expr.hs
+++ b/compiler/GHC/Cmm/Expr.hs
@@ -46,7 +46,6 @@ import GHC.Cmm.CLabel
import GHC.Cmm.MachOp
import GHC.Cmm.Type
import GHC.Cmm.Reg
-import GHC.Utils.Trace (pprTrace)
import GHC.Utils.Panic (panic)
import GHC.Utils.Outputable
diff --git a/compiler/GHC/CmmToAsm/BlockLayout.hs b/compiler/GHC/CmmToAsm/BlockLayout.hs
index 2d4f75be5c..1a5aec2f51 100644
--- a/compiler/GHC/CmmToAsm/BlockLayout.hs
+++ b/compiler/GHC/CmmToAsm/BlockLayout.hs
@@ -35,7 +35,6 @@ import GHC.Data.Maybe
import GHC.Data.List.SetOps (removeDups)
import GHC.Data.OrdList
-import GHC.Utils.Trace
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
diff --git a/compiler/GHC/CmmToC.hs b/compiler/GHC/CmmToC.hs
index c492e6f1a3..759e40a4f0 100644
--- a/compiler/GHC/CmmToC.hs
+++ b/compiler/GHC/CmmToC.hs
@@ -53,7 +53,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Monad.State.Strict (State (..), runState, state)
import GHC.Utils.Misc
-import GHC.Utils.Trace
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs
index 927d67ddab..6fa8fc1273 100644
--- a/compiler/GHC/Core/Coercion/Opt.hs
+++ b/compiler/GHC/Core/Coercion/Opt.hs
@@ -32,7 +32,6 @@ import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Misc
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Monad ( zipWithM )
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index f983c49d6f..086a727095 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -86,7 +86,6 @@ import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Misc
-import GHC.Utils.Trace
import GHC.Utils.Error
import qualified GHC.Utils.Error as Err
import GHC.Utils.Logger
diff --git a/compiler/GHC/Core/Opt/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs
index 922c79b746..51d14be05a 100644
--- a/compiler/GHC/Core/Opt/Arity.hs
+++ b/compiler/GHC/Core/Opt/Arity.hs
@@ -85,7 +85,6 @@ import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import GHC.Utils.Misc
{-
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index dbbb36b8e6..9b81479970 100644
--- a/compiler/GHC/Core/Opt/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -70,7 +70,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Misc
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Applicative ( Alternative(..) )
import Control.Monad
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index 4f5d23c05c..c6c5d11926 100644
--- a/compiler/GHC/Core/Opt/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -46,8 +46,6 @@ import GHC.Builtin.Types.Prim ( realWorldStatePrimTy )
import GHC.Types.Unique.Set
import GHC.Types.Unique.MemoFun
-import GHC.Utils.Trace
-_ = pprTrace -- Tired of commenting out the import all the time
{-
************************************************************************
diff --git a/compiler/GHC/Core/Opt/OccurAnal.hs b/compiler/GHC/Core/Opt/OccurAnal.hs
index c60dbfc39d..0c6f4d5413 100644
--- a/compiler/GHC/Core/Opt/OccurAnal.hs
+++ b/compiler/GHC/Core/Opt/OccurAnal.hs
@@ -54,7 +54,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Misc
-import GHC.Utils.Trace
import GHC.Builtin.Names( runRWKey )
import GHC.Unit.Module( Module )
diff --git a/compiler/GHC/Core/Opt/SetLevels.hs b/compiler/GHC/Core/Opt/SetLevels.hs
index da328da1ce..b970270cfe 100644
--- a/compiler/GHC/Core/Opt/SetLevels.hs
+++ b/compiler/GHC/Core/Opt/SetLevels.hs
@@ -112,7 +112,6 @@ import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Data.Maybe
diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs
index 1c84db9eea..e473cd24af 100644
--- a/compiler/GHC/Core/Opt/Simplify.hs
+++ b/compiler/GHC/Core/Opt/Simplify.hs
@@ -27,7 +27,6 @@ import GHC.Utils.Error ( withTiming )
import GHC.Utils.Logger as Logger
import GHC.Utils.Outputable
import GHC.Utils.Constants (debugIsOn)
-import GHC.Utils.Trace
import GHC.Unit.Env ( UnitEnv, ueEPS )
import GHC.Unit.External
diff --git a/compiler/GHC/Core/Opt/Simplify/Iteration.hs b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
index 49707fecf4..39e0e892d2 100644
--- a/compiler/GHC/Core/Opt/Simplify/Iteration.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
@@ -68,7 +68,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Constants (debugIsOn)
-import GHC.Utils.Trace
import GHC.Utils.Monad ( mapAccumLM, liftIO )
import GHC.Utils.Logger
import GHC.Utils.Misc
diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs
index 8325a04718..88e6b409d5 100644
--- a/compiler/GHC/Core/Opt/Simplify/Utils.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs
@@ -80,7 +80,6 @@ import GHC.Utils.Monad
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Monad ( when )
import Data.List ( sortBy )
diff --git a/compiler/GHC/Core/Opt/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs
index 12d9ceb0fa..b0a8efc1f2 100644
--- a/compiler/GHC/Core/Opt/SpecConstr.hs
+++ b/compiler/GHC/Core/Opt/SpecConstr.hs
@@ -73,7 +73,6 @@ import GHC.Utils.Panic.Plain
import GHC.Utils.Panic
import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Monad
-import GHC.Utils.Trace
import GHC.Builtin.Names ( specTyConKey )
diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs
index 7d7f37b741..22c3e50f73 100644
--- a/compiler/GHC/Core/Opt/Specialise.hs
+++ b/compiler/GHC/Core/Opt/Specialise.hs
@@ -58,7 +58,6 @@ import GHC.Utils.Monad ( foldlM )
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
-import GHC.Utils.Trace
import GHC.Unit.Module( Module )
import GHC.Unit.Module.ModGuts
diff --git a/compiler/GHC/Core/Opt/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs
index d4fac1f869..1ed95703af 100644
--- a/compiler/GHC/Core/Opt/WorkWrap.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap.hs
@@ -35,7 +35,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Monad
-import GHC.Utils.Trace
import GHC.Core.DataCon
{-
diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
index 6f6e1ea1c3..28dab48941 100644
--- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
@@ -56,7 +56,6 @@ import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Applicative ( (<|>) )
import Control.Monad ( zipWithM )
diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs
index 5beb618730..428baa348e 100644
--- a/compiler/GHC/Core/Rules.hs
+++ b/compiler/GHC/Core/Rules.hs
@@ -78,7 +78,6 @@ import GHC.Data.Maybe
import GHC.Data.Bag
import GHC.Utils.Misc as Utils
-import GHC.Utils.Trace
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Constants (debugIsOn)
diff --git a/compiler/GHC/Core/Tidy.hs b/compiler/GHC/Core/Tidy.hs
index af48f42f23..1ca425fcf2 100644
--- a/compiler/GHC/Core/Tidy.hs
+++ b/compiler/GHC/Core/Tidy.hs
@@ -34,7 +34,6 @@ import GHC.Types.Tickish
import GHC.Data.Maybe
import GHC.Utils.Misc
import Data.List (mapAccumL)
--- import GHC.Utils.Trace
import GHC.Utils.Outputable
import GHC.Types.RepType (typePrimRep)
import GHC.Utils.Panic
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs
index b97200909f..bbce904167 100644
--- a/compiler/GHC/Core/Utils.hs
+++ b/compiler/GHC/Core/Utils.hs
@@ -107,7 +107,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Misc
-import GHC.Utils.Trace
import Data.ByteString ( ByteString )
import Data.Function ( on )
diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs
index c696127bc0..ad2d8497ff 100644
--- a/compiler/GHC/CoreToIface.hs
+++ b/compiler/GHC/CoreToIface.hs
@@ -82,7 +82,6 @@ import GHC.Types.Cpr ( topCprSig )
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc
-import GHC.Utils.Trace
import Data.Maybe ( catMaybes )
diff --git a/compiler/GHC/CoreToStg.hs b/compiler/GHC/CoreToStg.hs
index 9446e1186e..cd1753499a 100644
--- a/compiler/GHC/CoreToStg.hs
+++ b/compiler/GHC/CoreToStg.hs
@@ -56,7 +56,6 @@ import GHC.Utils.Monad
import GHC.Utils.Misc (HasDebugCallStack)
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Monad (ap)
import Data.Maybe (fromMaybe)
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs
index f4430918e6..9ca8bff0c9 100644
--- a/compiler/GHC/CoreToStg/Prep.hs
+++ b/compiler/GHC/CoreToStg/Prep.hs
@@ -55,7 +55,6 @@ import GHC.Utils.Panic.Plain
import GHC.Utils.Outputable
import GHC.Utils.Monad ( mapAccumLM )
import GHC.Utils.Logger
-import GHC.Utils.Trace
import GHC.Types.Demand
import GHC.Types.Var
diff --git a/compiler/GHC/Data/Bool.hs b/compiler/GHC/Data/Bool.hs
index ab38f8fe78..b82658120f 100644
--- a/compiler/GHC/Data/Bool.hs
+++ b/compiler/GHC/Data/Bool.hs
@@ -4,7 +4,7 @@ module GHC.Data.Bool
)
where
-import GHC.Prelude
+import GHC.Prelude.Basic
data OverridingBool
= Auto
diff --git a/compiler/GHC/Data/FastMutInt.hs b/compiler/GHC/Data/FastMutInt.hs
index 3b78966577..aebc1dd028 100644
--- a/compiler/GHC/Data/FastMutInt.hs
+++ b/compiler/GHC/Data/FastMutInt.hs
@@ -13,7 +13,7 @@ module GHC.Data.FastMutInt(
atomicFetchAddFastMut
) where
-import GHC.Prelude
+import GHC.Prelude.Basic
import GHC.Base
diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs
index 98814fa6b3..53fd8e63b0 100644
--- a/compiler/GHC/Data/FastString.hs
+++ b/compiler/GHC/Data/FastString.hs
@@ -108,7 +108,7 @@ module GHC.Data.FastString
lengthPS
) where
-import GHC.Prelude as Prelude
+import GHC.Prelude.Basic as Prelude
import GHC.Utils.Encoding
import GHC.Utils.IO.Unsafe
diff --git a/compiler/GHC/Data/List/SetOps.hs b/compiler/GHC/Data/List/SetOps.hs
index dff41991da..99bf2fe903 100644
--- a/compiler/GHC/Data/List/SetOps.hs
+++ b/compiler/GHC/Data/List/SetOps.hs
@@ -33,7 +33,6 @@ import GHC.Prelude
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc
-import GHC.Utils.Trace
import qualified Data.List as L
import qualified Data.List.NonEmpty as NE
diff --git a/compiler/GHC/Driver/Config/StgToCmm.hs b/compiler/GHC/Driver/Config/StgToCmm.hs
index 38e8f6684d..fab7b213e3 100644
--- a/compiler/GHC/Driver/Config/StgToCmm.hs
+++ b/compiler/GHC/Driver/Config/StgToCmm.hs
@@ -2,6 +2,8 @@ module GHC.Driver.Config.StgToCmm
( initStgToCmmConfig
) where
+import GHC.Prelude.Basic
+
import GHC.StgToCmm.Config
import GHC.Driver.Backend
@@ -12,9 +14,6 @@ import GHC.Utils.Error
import GHC.Unit.Module
import GHC.Utils.Outputable
-import Data.Maybe
-import Prelude
-
initStgToCmmConfig :: DynFlags -> Module -> StgToCmmConfig
initStgToCmmConfig dflags mod = StgToCmmConfig
-- settings
diff --git a/compiler/GHC/Driver/Env.hs b/compiler/GHC/Driver/Env.hs
index edca007608..492adc82cc 100644
--- a/compiler/GHC/Driver/Env.hs
+++ b/compiler/GHC/Driver/Env.hs
@@ -81,7 +81,6 @@ import GHC.Utils.Monad
import GHC.Utils.Panic
import GHC.Utils.Misc
import GHC.Utils.Logger
-import GHC.Utils.Trace
import Data.IORef
import qualified Data.Set as Set
diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs
index b5e31de532..683b998ad1 100644
--- a/compiler/GHC/HsToCore/Binds.hs
+++ b/compiler/GHC/HsToCore/Binds.hs
@@ -80,7 +80,6 @@ import GHC.Utils.Monad
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Control.Monad
diff --git a/compiler/GHC/HsToCore/Pmc/Solver.hs b/compiler/GHC/HsToCore/Pmc/Solver.hs
index a1bf167903..17a24ced55 100644
--- a/compiler/GHC/HsToCore/Pmc/Solver.hs
+++ b/compiler/GHC/HsToCore/Pmc/Solver.hs
@@ -97,9 +97,6 @@ import Data.List (sortBy, find)
import qualified Data.List.NonEmpty as NE
import Data.Ord (comparing)
-import GHC.Utils.Trace
-_ = pprTrace -- to silence unused import warnings
-
--
-- * Main exports
--
diff --git a/compiler/GHC/Iface/Load.hs b/compiler/GHC/Iface/Load.hs
index aabca631b8..b169db60f5 100644
--- a/compiler/GHC/Iface/Load.hs
+++ b/compiler/GHC/Iface/Load.hs
@@ -68,7 +68,6 @@ import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Logger
-import GHC.Utils.Trace
import GHC.Settings.Constants
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs
index 44e332e45c..e84d342324 100644
--- a/compiler/GHC/Iface/Make.hs
+++ b/compiler/GHC/Iface/Make.hs
@@ -79,7 +79,6 @@ import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Misc
import GHC.Utils.Logger
-import GHC.Utils.Trace
import GHC.Data.FastString
import GHC.Data.Maybe
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs
index ac4c2fe59e..896f32df0a 100644
--- a/compiler/GHC/Iface/Recomp.hs
+++ b/compiler/GHC/Iface/Recomp.hs
@@ -50,7 +50,6 @@ import GHC.Utils.Fingerprint
import GHC.Utils.Exception
import GHC.Utils.Logger
import GHC.Utils.Constants (debugIsOn)
-import GHC.Utils.Trace
import GHC.Types.Annotations
import GHC.Types.Name
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs
index 1af2b99fc3..327bb28412 100644
--- a/compiler/GHC/Iface/Tidy.hs
+++ b/compiler/GHC/Iface/Tidy.hs
@@ -42,7 +42,6 @@ import GHC.Iface.Env
import GHC.Utils.Outputable
import GHC.Utils.Misc( filterOut )
import GHC.Utils.Panic
-import GHC.Utils.Trace
import GHC.Utils.Logger as Logger
import qualified GHC.Utils.Error as Err
diff --git a/compiler/GHC/Prelude.hs b/compiler/GHC/Prelude.hs
index 81d860f618..30f67573cf 100644
--- a/compiler/GHC/Prelude.hs
+++ b/compiler/GHC/Prelude.hs
@@ -13,10 +13,8 @@
-- * Explicitly imports GHC.Prelude
module GHC.Prelude
- (module X
- ,Applicative (..)
- ,module Bits
- ,shiftL, shiftR
+ (module GHC.Prelude
+ ,module GHC.Utils.Trace
) where
@@ -48,55 +46,7 @@ NoImplicitPrelude. There are two motivations for this:
extensions.
-}
-import Prelude as X hiding ((<>), Applicative(..))
-import Control.Applicative (Applicative(..))
-import Data.Foldable as X (foldl')
+import GHC.Prelude.Basic as GHC.Prelude
-#if MIN_VERSION_base(4,16,0)
-import GHC.Bits as Bits hiding (shiftL, shiftR)
-# if defined(DEBUG)
-import qualified GHC.Bits as Bits (shiftL, shiftR)
-# endif
-
-#else
---base <4.15
-import Data.Bits as Bits hiding (shiftL, shiftR)
-# if defined(DEBUG)
-import qualified Data.Bits as Bits (shiftL, shiftR)
-# endif
-#endif
-
-{- Note [Default to unsafe shifts inside GHC]
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The safe shifts can introduce branches which come
-at the cost of performance. We still want the additional
-debugability for debug builds. So we define it as one or the
-other depending on the DEBUG setting.
-
-Why do we then continue on to re-export the rest of Data.Bits?
-If we would not what is likely to happen is:
-* Someone imports Data.Bits, uses xor. Things are fine.
-* They add a shift and get an ambiguous definition error.
-* The are puzzled for a bit.
-* They either:
- + Remove the import of Data.Bits and get an error because xor is not in scope.
- + Add the hiding clause to the Data.Bits import for the shifts.
-
-Either is quite annoying. Simply re-exporting all of Data.Bits avoids this
-making for a smoother developer experience. At the cost of having a few more
-names in scope at all time. But that seems like a fair tradeoff.
-
-See also #19618
--}
-
--- We always want the Data.Bits method to show up for rules etc.
-{-# INLINE shiftL #-}
-{-# INLINE shiftR #-}
-shiftL, shiftR :: Bits.Bits a => a -> Int -> a
-#if defined(DEBUG)
-shiftL = Bits.shiftL
-shiftR = Bits.shiftR
-#else
-shiftL = Bits.unsafeShiftL
-shiftR = Bits.unsafeShiftR
-#endif
+-- import {-# SOURCE #-} GHC.Utils.Trace
+import GHC.Utils.Trace hiding ( trace )
diff --git a/compiler/GHC/Prelude/Basic.hs b/compiler/GHC/Prelude/Basic.hs
new file mode 100644
index 0000000000..cfa21df26f
--- /dev/null
+++ b/compiler/GHC/Prelude/Basic.hs
@@ -0,0 +1,104 @@
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_HADDOCK not-home #-}
+{-# OPTIONS_GHC -O2 #-} -- See Note [-O2 Prelude]
+
+-- | Custom minimal GHC "Prelude"
+--
+-- This module serves as a replacement for the "Prelude" module
+-- and abstracts over differences between the bootstrapping
+-- GHC version, and may also provide a common default vocabulary.
+
+-- Every module in GHC
+-- * Is compiled with -XNoImplicitPrelude
+-- * Explicitly imports GHC.BasicPrelude or GHC.Prelude
+-- * The later provides some functionality with within ghc itself
+-- like pprTrace.
+
+module GHC.Prelude.Basic
+ (module X
+ ,Applicative (..)
+ ,module Bits
+ ,shiftL, shiftR
+ ) where
+
+
+{- Note [-O2 Prelude]
+~~~~~~~~~~~~~~~~~~~~~
+There is some code in GHC that is *always* compiled with -O[2] because
+of it's impact on compile time performance. Some of this code might depend
+on the definitions like shiftL being defined here being performant.
+
+So we always compile this module with -O2. It's (currently) tiny so I
+have little reason to suspect this impacts overall GHC compile times
+negatively.
+
+-}
+-- We export the 'Semigroup' class but w/o the (<>) operator to avoid
+-- clashing with the (Outputable.<>) operator which is heavily used
+-- through GHC's code-base.
+
+{-
+Note [Why do we import Prelude here?]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The files ghc-boot-th.cabal, ghc-boot.cabal, ghci.cabal and
+ghc-heap.cabal contain the directive default-extensions:
+NoImplicitPrelude. There are two motivations for this:
+ - Consistency with the compiler directory, which enables
+ NoImplicitPrelude;
+ - Allows loading the above dependent packages with ghc-in-ghci,
+ giving a smoother development experience when adding new
+ extensions.
+-}
+
+import Prelude as X hiding ((<>), Applicative(..))
+import Control.Applicative (Applicative(..))
+import Data.Foldable as X (foldl')
+
+#if MIN_VERSION_base(4,16,0)
+import GHC.Bits as Bits hiding (shiftL, shiftR)
+# if defined(DEBUG)
+import qualified GHC.Bits as Bits (shiftL, shiftR)
+# endif
+
+#else
+--base <4.15
+import Data.Bits as Bits hiding (shiftL, shiftR)
+# if defined(DEBUG)
+import qualified Data.Bits as Bits (shiftL, shiftR)
+# endif
+#endif
+
+{- Note [Default to unsafe shifts inside GHC]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The safe shifts can introduce branches which come
+at the cost of performance. We still want the additional
+debugability for debug builds. So we define it as one or the
+other depending on the DEBUG setting.
+
+Why do we then continue on to re-export the rest of Data.Bits?
+If we would not what is likely to happen is:
+* Someone imports Data.Bits, uses xor. Things are fine.
+* They add a shift and get an ambiguous definition error.
+* The are puzzled for a bit.
+* They either:
+ + Remove the import of Data.Bits and get an error because xor is not in scope.
+ + Add the hiding clause to the Data.Bits import for the shifts.
+
+Either is quite annoying. Simply re-exporting all of Data.Bits avoids this
+making for a smoother developer experience. At the cost of having a few more
+names in scope at all time. But that seems like a fair tradeoff.
+
+See also #19618
+-}
+
+-- We always want the Data.Bits method to show up for rules etc.
+{-# INLINE shiftL #-}
+{-# INLINE shiftR #-}
+shiftL, shiftR :: Bits.Bits a => a -> Int -> a
+#if defined(DEBUG)
+shiftL = Bits.shiftL
+shiftR = Bits.shiftR
+#else
+shiftL = Bits.unsafeShiftL
+shiftR = Bits.unsafeShiftR
+#endif
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs
index 6a98ba1893..da2d5b0d57 100644
--- a/compiler/GHC/Rename/Names.hs
+++ b/compiler/GHC/Rename/Names.hs
@@ -56,7 +56,6 @@ import qualified GHC.LanguageExtensions as LangExt
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Misc as Utils
import GHC.Utils.Panic
-import GHC.Utils.Trace
import GHC.Types.Fixity.Env
import GHC.Types.SafeHaskell
diff --git a/compiler/GHC/Runtime/Eval.hs b/compiler/GHC/Runtime/Eval.hs
index abe98c2635..3acebb5894 100644
--- a/compiler/GHC/Runtime/Eval.hs
+++ b/compiler/GHC/Runtime/Eval.hs
@@ -91,7 +91,6 @@ import GHC.Utils.Error
import GHC.Utils.Outputable
import GHC.Utils.Misc
import GHC.Utils.Logger
-import GHC.Utils.Trace
import GHC.Types.RepType
import GHC.Types.Fixity.Env
diff --git a/compiler/GHC/Stg/InferTags/Rewrite.hs b/compiler/GHC/Stg/InferTags/Rewrite.hs
index 060ebcac22..171de2da91 100644
--- a/compiler/GHC/Stg/InferTags/Rewrite.hs
+++ b/compiler/GHC/Stg/InferTags/Rewrite.hs
@@ -52,9 +52,6 @@ import GHC.Stg.InferTags.Types
import Control.Monad
--- import GHC.Utils.Trace
--- import GHC.Driver.Ppr
-
newtype RM a = RM { unRM :: (State (UniqFM Id TagSig, UniqSupply, Module, IdSet) a) }
deriving (Functor, Monad, Applicative)
diff --git a/compiler/GHC/Stg/Subst.hs b/compiler/GHC/Stg/Subst.hs
index fa7107fc86..0983abf7a1 100644
--- a/compiler/GHC/Stg/Subst.hs
+++ b/compiler/GHC/Stg/Subst.hs
@@ -11,7 +11,6 @@ import GHC.Utils.Monad.State.Strict
import GHC.Utils.Outputable
import GHC.Utils.Misc
import GHC.Utils.Panic
-import GHC.Utils.Trace
-- | A renaming substitution from 'Id's to 'Id's. Like 'RnEnv2', but not
-- maintaining pairs of substitutions. Like 'GHC.Core.Subst.Subst', but
diff --git a/compiler/GHC/StgToCmm/Ticky.hs b/compiler/GHC/StgToCmm/Ticky.hs
index 6e9b84d53c..0ca679901a 100644
--- a/compiler/GHC/StgToCmm/Ticky.hs
+++ b/compiler/GHC/StgToCmm/Ticky.hs
@@ -154,7 +154,6 @@ import Data.Maybe
import qualified Data.Char
import Control.Monad ( when, unless )
import GHC.Types.Id.Info
-import GHC.Utils.Trace
import GHC.StgToCmm.Env (getCgInfo_maybe)
import Data.Coerce (coerce)
import GHC.Utils.Json
diff --git a/compiler/GHC/Tc/Errors/Hole.hs b/compiler/GHC/Tc/Errors/Hole.hs
index 14c0e029e6..8ec874da41 100644
--- a/compiler/GHC/Tc/Errors/Hole.hs
+++ b/compiler/GHC/Tc/Errors/Hole.hs
@@ -82,7 +82,6 @@ import GHC.Builtin.Utils (knownKeyNames)
import GHC.Tc.Errors.Hole.FitTypes
import qualified Data.Set as Set
import GHC.Types.SrcLoc
-import GHC.Utils.Trace (warnPprTrace)
import GHC.Data.FastString (unpackFS)
import GHC.Types.Unique.Map
diff --git a/compiler/GHC/Tc/Gen/Splice.hs b/compiler/GHC/Tc/Gen/Splice.hs
index 1ac3882d50..91c9b68736 100644
--- a/compiler/GHC/Tc/Gen/Splice.hs
+++ b/compiler/GHC/Tc/Gen/Splice.hs
@@ -118,7 +118,6 @@ import GHC.Unit.Module.ModIface
import GHC.Unit.Module.Deps
import GHC.Utils.Misc
-import GHC.Utils.Trace
import GHC.Utils.Panic as Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Lexeme
diff --git a/compiler/GHC/Tc/Utils/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs
index 68b8285af8..b2b8c26be4 100644
--- a/compiler/GHC/Tc/Utils/TcMType.hs
+++ b/compiler/GHC/Tc/Utils/TcMType.hs
@@ -149,7 +149,6 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Utils.Constants (debugIsOn)
-import GHC.Utils.Trace
import Control.Monad
import GHC.Data.Maybe
diff --git a/compiler/GHC/Types/Demand.hs b/compiler/GHC/Types/Demand.hs
index 71693748e0..02fa910e94 100644
--- a/compiler/GHC/Types/Demand.hs
+++ b/compiler/GHC/Types/Demand.hs
@@ -106,9 +106,6 @@ import GHC.Utils.Panic.Plain
import Data.Coerce (coerce)
import Data.Function
-import GHC.Utils.Trace
-_ = pprTrace -- Tired of commenting out the import all the time
-
{-
************************************************************************
* *
diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs
index bab0ca01a6..d79b4acf2f 100644
--- a/compiler/GHC/Types/Id.hs
+++ b/compiler/GHC/Types/Id.hs
@@ -163,7 +163,6 @@ import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import GHC.Stg.InferTags.TagSig
-- infixl so you can say (id `set` a `set` b)
diff --git a/compiler/GHC/Types/Name/Occurrence.hs-boot b/compiler/GHC/Types/Name/Occurrence.hs-boot
index 92661cb42b..cb39f6e679 100644
--- a/compiler/GHC/Types/Name/Occurrence.hs-boot
+++ b/compiler/GHC/Types/Name/Occurrence.hs-boot
@@ -1,6 +1,6 @@
module GHC.Types.Name.Occurrence where
-import GHC.Data.FastString
+import GHC.Data.FastString ( FastString )
data OccName
diff --git a/compiler/GHC/Types/TyThing/Ppr.hs b/compiler/GHC/Types/TyThing/Ppr.hs
index 8b203aac20..6cc31ad317 100644
--- a/compiler/GHC/Types/TyThing/Ppr.hs
+++ b/compiler/GHC/Types/TyThing/Ppr.hs
@@ -31,7 +31,6 @@ import GHC.Iface.Syntax ( ShowSub(..), ShowHowMuch(..), AltPpr(..)
import GHC.Iface.Make ( tyThingToIfaceDecl )
import GHC.Utils.Outputable
-import GHC.Utils.Trace
import Data.Maybe ( isJust )
diff --git a/compiler/GHC/Unit/Types.hs b/compiler/GHC/Unit/Types.hs
index c0d314baa0..0e08f6860b 100644
--- a/compiler/GHC/Unit/Types.hs
+++ b/compiler/GHC/Unit/Types.hs
@@ -89,6 +89,7 @@ module GHC.Unit.Types
where
import GHC.Prelude
+
import GHC.Types.Unique
import GHC.Types.Unique.DSet
import GHC.Utils.Binary
diff --git a/compiler/GHC/Unit/Types.hs-boot b/compiler/GHC/Unit/Types.hs-boot
index 4200fdb18c..d303089327 100644
--- a/compiler/GHC/Unit/Types.hs-boot
+++ b/compiler/GHC/Unit/Types.hs-boot
@@ -1,7 +1,7 @@
{-# LANGUAGE KindSignatures #-}
module GHC.Unit.Types where
-import GHC.Prelude ()
+-- No Prelude. See Note [Exporting pprTrace from GHC.Prelude]
import Language.Haskell.Syntax.Module.Name (ModuleName)
import Data.Kind (Type)
diff --git a/compiler/GHC/Utils/BufHandle.hs b/compiler/GHC/Utils/BufHandle.hs
index aed15610cb..b7b0981117 100644
--- a/compiler/GHC/Utils/BufHandle.hs
+++ b/compiler/GHC/Utils/BufHandle.hs
@@ -24,7 +24,7 @@ module GHC.Utils.BufHandle (
bFlush,
) where
-import GHC.Prelude
+import GHC.Prelude.Basic
import GHC.Data.FastString
import GHC.Data.FastMutInt
diff --git a/compiler/GHC/Utils/Constants.hs b/compiler/GHC/Utils/Constants.hs
index 518c5f31be..470a98d3c6 100644
--- a/compiler/GHC/Utils/Constants.hs
+++ b/compiler/GHC/Utils/Constants.hs
@@ -8,7 +8,7 @@ module GHC.Utils.Constants
)
where
-import GHC.Prelude
+import GHC.Prelude.Basic
{-
diff --git a/compiler/GHC/Utils/Exception.hs b/compiler/GHC/Utils/Exception.hs
index b07baa4625..adb6d33921 100644
--- a/compiler/GHC/Utils/Exception.hs
+++ b/compiler/GHC/Utils/Exception.hs
@@ -8,7 +8,7 @@ module GHC.Utils.Exception
)
where
-import GHC.Prelude
+import GHC.Prelude.Basic
import GHC.IO (catchException)
import Control.Exception as CE hiding (assert)
diff --git a/compiler/GHC/Utils/Fingerprint.hs b/compiler/GHC/Utils/Fingerprint.hs
index 95f510ac48..236ae8d7b6 100644
--- a/compiler/GHC/Utils/Fingerprint.hs
+++ b/compiler/GHC/Utils/Fingerprint.hs
@@ -22,7 +22,7 @@ module GHC.Utils.Fingerprint (
getFileHash
) where
-import GHC.Prelude
+import GHC.Prelude.Basic
import Foreign
import GHC.IO
diff --git a/compiler/GHC/Utils/GlobalVars.hs b/compiler/GHC/Utils/GlobalVars.hs
index ad02bc45b1..5e2a24fe7e 100644
--- a/compiler/GHC/Utils/GlobalVars.hs
+++ b/compiler/GHC/Utils/GlobalVars.hs
@@ -22,7 +22,7 @@ module GHC.Utils.GlobalVars
)
where
-import GHC.Prelude
+import GHC.Prelude.Basic
import GHC.Conc.Sync ( sharedCAF )
diff --git a/compiler/GHC/Utils/IO/Unsafe.hs b/compiler/GHC/Utils/IO/Unsafe.hs
index 4adf71bd11..feeebfedfe 100644
--- a/compiler/GHC/Utils/IO/Unsafe.hs
+++ b/compiler/GHC/Utils/IO/Unsafe.hs
@@ -9,7 +9,7 @@ module GHC.Utils.IO.Unsafe
)
where
-import GHC.Prelude ()
+import GHC.Prelude.Basic ()
import GHC.Exts
import GHC.IO (IO(..))
diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs
index 4020f1263f..da532279f7 100644
--- a/compiler/GHC/Utils/Misc.hs
+++ b/compiler/GHC/Utils/Misc.hs
@@ -124,7 +124,7 @@ module GHC.Utils.Misc (
HasDebugCallStack,
) where
-import GHC.Prelude hiding ( head, init, last, tail )
+import GHC.Prelude.Basic hiding ( head, init, last, tail )
import GHC.Utils.Exception
import GHC.Utils.Panic.Plain
diff --git a/compiler/GHC/Utils/Outputable.hs b/compiler/GHC/Utils/Outputable.hs
index 4e174ff4d0..d7300242bd 100644
--- a/compiler/GHC/Utils/Outputable.hs
+++ b/compiler/GHC/Utils/Outputable.hs
@@ -108,7 +108,7 @@ module GHC.Utils.Outputable (
import Language.Haskell.Syntax.Module.Name ( ModuleName(..) )
-import GHC.Prelude
+import GHC.Prelude.Basic
import {-# SOURCE #-} GHC.Unit.Types ( Unit, Module, moduleName )
import {-# SOURCE #-} GHC.Types.Name.Occurrence( OccName )
diff --git a/compiler/GHC/Utils/Panic.hs b/compiler/GHC/Utils/Panic.hs
index f0dde90763..0774a5f1c3 100644
--- a/compiler/GHC/Utils/Panic.hs
+++ b/compiler/GHC/Utils/Panic.hs
@@ -52,7 +52,7 @@ module GHC.Utils.Panic
)
where
-import GHC.Prelude
+import GHC.Prelude.Basic
import GHC.Stack
import GHC.Utils.Outputable
diff --git a/compiler/GHC/Utils/Panic/Plain.hs b/compiler/GHC/Utils/Panic/Plain.hs
index 355c1c039d..656b7f2fa8 100644
--- a/compiler/GHC/Utils/Panic/Plain.hs
+++ b/compiler/GHC/Utils/Panic/Plain.hs
@@ -28,7 +28,7 @@ import GHC.Settings.Config
import GHC.Utils.Constants
import GHC.Utils.Exception as Exception
import GHC.Stack
-import GHC.Prelude
+import GHC.Prelude.Basic
import System.IO.Unsafe
-- | This type is very similar to 'GHC.Utils.Panic.GhcException', but it omits
diff --git a/compiler/GHC/Utils/Ppr.hs b/compiler/GHC/Utils/Ppr.hs
index af2b6f977a..ad68b40dc9 100644
--- a/compiler/GHC/Utils/Ppr.hs
+++ b/compiler/GHC/Utils/Ppr.hs
@@ -111,7 +111,7 @@ module GHC.Utils.Ppr (
) where
-import GHC.Prelude hiding (error)
+import GHC.Prelude.Basic hiding (error)
import GHC.Utils.BufHandle
import GHC.Data.FastString
diff --git a/compiler/GHC/Utils/Ppr/Colour.hs b/compiler/GHC/Utils/Ppr/Colour.hs
index 92044d96e4..e321688d70 100644
--- a/compiler/GHC/Utils/Ppr/Colour.hs
+++ b/compiler/GHC/Utils/Ppr/Colour.hs
@@ -1,5 +1,5 @@
module GHC.Utils.Ppr.Colour where
-import GHC.Prelude
+import GHC.Prelude.Basic
import Data.Maybe (fromMaybe)
import GHC.Data.Bool
diff --git a/compiler/GHC/Utils/Trace.hs b/compiler/GHC/Utils/Trace.hs
index c5f07df248..112d2f9ba5 100644
--- a/compiler/GHC/Utils/Trace.hs
+++ b/compiler/GHC/Utils/Trace.hs
@@ -13,7 +13,18 @@ module GHC.Utils.Trace
)
where
-import GHC.Prelude
+{- Note [Exporting pprTrace from GHC.Prelude]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+For our own sanity we want to export pprTrace from GHC.Prelude.
+Since calls to traces should never be performance sensitive it's okay for these
+to be source imports/exports. However we still need to make sure that all
+transitive imports from Trace.hs-boot do not import GHC.Prelude.
+
+To get there we import the basic GHC.Prelude.Basic prelude instead of GHC.Prelude
+within the transitive dependencies of Trace.hs
+-}
+
+import GHC.Prelude.Basic
import GHC.Utils.Outputable
import GHC.Utils.Exception
import GHC.Utils.Panic
diff --git a/compiler/Setup.hs b/compiler/Setup.hs
index 59746bf5a2..97662a7775 100644
--- a/compiler/Setup.hs
+++ b/compiler/Setup.hs
@@ -116,7 +116,7 @@ generateConfigHs settings = either error id $ do
, " , cStage"
, " ) where"
, ""
- , "import GHC.Prelude"
+ , "import GHC.Prelude.Basic"
, ""
, "import GHC.Version"
, ""
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 6f92f021da..944bfca5e1 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -560,6 +560,7 @@ Library
GHC.Platform.X86_64
GHC.Plugins
GHC.Prelude
+ GHC.Prelude.Basic
GHC.Rename.Bind
GHC.Rename.Doc
GHC.Rename.Env
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 8390aadb77..c41b6eed8f 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -384,7 +384,7 @@ generateConfigHs = do
, " , cStage"
, " ) where"
, ""
- , "import GHC.Prelude"
+ , "import GHC.Prelude.Basic"
, ""
, "import GHC.Version"
, ""
diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout
index f632445612..b875e35ddb 100644
--- a/testsuite/tests/count-deps/CountDepsAst.stdout
+++ b/testsuite/tests/count-deps/CountDepsAst.stdout
@@ -165,6 +165,7 @@ GHC.Platform.Ways
GHC.Platform.X86
GHC.Platform.X86_64
GHC.Prelude
+GHC.Prelude.Basic
GHC.Runtime.Context
GHC.Runtime.Eval.Types
GHC.Runtime.Heap.Layout
diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout
index 85623b21a7..2926e7b6bf 100644
--- a/testsuite/tests/count-deps/CountDepsParser.stdout
+++ b/testsuite/tests/count-deps/CountDepsParser.stdout
@@ -172,6 +172,7 @@ GHC.Platform.Ways
GHC.Platform.X86
GHC.Platform.X86_64
GHC.Prelude
+GHC.Prelude.Basic
GHC.Runtime.Context
GHC.Runtime.Eval.Types
GHC.Runtime.Heap.Layout