summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODEOWNERS40
-rw-r--r--compiler/GHC.hs16
-rw-r--r--compiler/GHC/Cmm/Expr.hs2
-rw-r--r--compiler/GHC/Cmm/Node.hs2
-rw-r--r--compiler/GHC/Core.hs2
-rw-r--r--compiler/GHC/Core/Arity.hs2
-rw-r--r--compiler/GHC/Core/Class.hs2
-rw-r--r--compiler/GHC/Core/Coercion.hs8
-rw-r--r--compiler/GHC/Core/Coercion/Axiom.hs4
-rw-r--r--compiler/GHC/Core/Coercion/Opt.hs2
-rw-r--r--compiler/GHC/Core/FamInstEnv.hs10
-rw-r--r--compiler/GHC/Core/InstEnv.hs12
-rw-r--r--compiler/GHC/Core/Lint.hs8
-rw-r--r--compiler/GHC/Core/Op/CSE.hs2
-rw-r--r--compiler/GHC/Core/Op/OccurAnal.hs4
-rw-r--r--compiler/GHC/Core/Op/Simplify.hs2
-rw-r--r--compiler/GHC/Core/Op/Specialise.hs2
-rw-r--r--compiler/GHC/Core/PatSyn.hs4
-rw-r--r--compiler/GHC/Core/Predicate.hs6
-rw-r--r--compiler/GHC/Core/Rules.hs20
-rw-r--r--compiler/GHC/Core/TyCo/FVs.hs6
-rw-r--r--compiler/GHC/Core/TyCo/Ppr.hs2
-rw-r--r--compiler/GHC/Core/TyCo/Rep.hs16
-rw-r--r--compiler/GHC/Core/TyCon.hs34
-rw-r--r--compiler/GHC/Core/Type.hs14
-rw-r--r--compiler/GHC/Core/Unify.hs4
-rw-r--r--compiler/GHC/CoreToStg/Prep.hs2
-rw-r--r--compiler/GHC/Driver/Backpack.hs4
-rw-r--r--compiler/GHC/Driver/Flags.hs2
-rw-r--r--compiler/GHC/Driver/Hooks.hs2
-rw-r--r--compiler/GHC/Driver/Main.hs14
-rw-r--r--compiler/GHC/Driver/Make.hs4
-rw-r--r--compiler/GHC/Driver/Pipeline.hs2
-rw-r--r--compiler/GHC/Driver/Plugins.hs8
-rw-r--r--compiler/GHC/Driver/Session.hs4
-rw-r--r--compiler/GHC/Driver/Types.hs12
-rw-r--r--compiler/GHC/Hs/Binds.hs16
-rw-r--r--compiler/GHC/Hs/Decls.hs14
-rw-r--r--compiler/GHC/Hs/Expr.hs12
-rw-r--r--compiler/GHC/Hs/Lit.hs2
-rw-r--r--compiler/GHC/Hs/Pat.hs8
-rw-r--r--compiler/GHC/Hs/Types.hs14
-rw-r--r--compiler/GHC/Hs/Utils.hs10
-rw-r--r--compiler/GHC/HsToCore.hs6
-rw-r--r--compiler/GHC/HsToCore/Arrows.hs6
-rw-r--r--compiler/GHC/HsToCore/Binds.hs16
-rw-r--r--compiler/GHC/HsToCore/Binds.hs-boot2
-rw-r--r--compiler/GHC/HsToCore/Docs.hs2
-rw-r--r--compiler/GHC/HsToCore/Expr.hs12
-rw-r--r--compiler/GHC/HsToCore/Foreign/Call.hs2
-rw-r--r--compiler/GHC/HsToCore/Foreign/Decl.hs6
-rw-r--r--compiler/GHC/HsToCore/ListComp.hs4
-rw-r--r--compiler/GHC/HsToCore/Match.hs6
-rw-r--r--compiler/GHC/HsToCore/Match.hs-boot2
-rw-r--r--compiler/GHC/HsToCore/Match/Constructor.hs2
-rw-r--r--compiler/GHC/HsToCore/Match/Literal.hs4
-rw-r--r--compiler/GHC/HsToCore/Monad.hs8
-rw-r--r--compiler/GHC/HsToCore/PmCheck.hs8
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Oracle.hs8
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Types.hs6
-rw-r--r--compiler/GHC/HsToCore/Quote.hs8
-rw-r--r--compiler/GHC/HsToCore/Usage.hs2
-rw-r--r--compiler/GHC/HsToCore/Utils.hs6
-rw-r--r--compiler/GHC/Iface/Binary.hs2
-rw-r--r--compiler/GHC/Iface/Env.hs2
-rw-r--r--compiler/GHC/Iface/Env.hs-boot2
-rw-r--r--compiler/GHC/Iface/Ext/Ast.hs4
-rw-r--r--compiler/GHC/Iface/Load.hs6
-rw-r--r--compiler/GHC/Iface/Load.hs-boot2
-rw-r--r--compiler/GHC/Iface/Make.hs8
-rw-r--r--compiler/GHC/Iface/Recomp.hs2
-rw-r--r--compiler/GHC/Iface/Rename.hs2
-rw-r--r--compiler/GHC/Iface/Syntax.hs2
-rw-r--r--compiler/GHC/Iface/Tidy.hs6
-rw-r--r--compiler/GHC/IfaceToCore.hs6
-rw-r--r--compiler/GHC/IfaceToCore.hs-boot2
-rw-r--r--compiler/GHC/Plugins.hs4
-rw-r--r--compiler/GHC/Rename/Bind.hs (renamed from compiler/GHC/Rename/Binds.hs)14
-rw-r--r--compiler/GHC/Rename/Doc.hs2
-rw-r--r--compiler/GHC/Rename/Env.hs8
-rw-r--r--compiler/GHC/Rename/Expr.hs14
-rw-r--r--compiler/GHC/Rename/Expr.hs-boot2
-rw-r--r--compiler/GHC/Rename/Fixity.hs2
-rw-r--r--compiler/GHC/Rename/HsType.hs (renamed from compiler/GHC/Rename/Types.hs)8
-rw-r--r--compiler/GHC/Rename/Module.hs (renamed from compiler/GHC/Rename/Source.hs)22
-rw-r--r--compiler/GHC/Rename/Names.hs4
-rw-r--r--compiler/GHC/Rename/Pat.hs10
-rw-r--r--compiler/GHC/Rename/Splice.hs32
-rw-r--r--compiler/GHC/Rename/Splice.hs-boot2
-rw-r--r--compiler/GHC/Rename/Unbound.hs4
-rw-r--r--compiler/GHC/Rename/Utils.hs6
-rw-r--r--compiler/GHC/Runtime/Eval.hs22
-rw-r--r--compiler/GHC/Runtime/Heap/Inspect.hs14
-rw-r--r--compiler/GHC/Runtime/Linker.hs2
-rw-r--r--compiler/GHC/Runtime/Loader.hs4
-rw-r--r--compiler/GHC/StgToCmm/Closure.hs4
-rw-r--r--compiler/GHC/StgToCmm/Ticky.hs2
-rw-r--r--compiler/GHC/Tc/Deriv.hs (renamed from compiler/typecheck/TcDeriv.hs)71
-rw-r--r--compiler/GHC/Tc/Deriv/Functor.hs (renamed from compiler/typecheck/TcGenFunctor.hs)25
-rw-r--r--compiler/GHC/Tc/Deriv/Generate.hs (renamed from compiler/typecheck/TcGenDeriv.hs)37
-rw-r--r--compiler/GHC/Tc/Deriv/Generics.hs (renamed from compiler/typecheck/TcGenGenerics.hs)34
-rw-r--r--compiler/GHC/Tc/Deriv/Infer.hs (renamed from compiler/typecheck/TcDerivInfer.hs)43
-rw-r--r--compiler/GHC/Tc/Deriv/Utils.hs (renamed from compiler/typecheck/TcDerivUtils.hs)51
-rw-r--r--compiler/GHC/Tc/Errors.hs (renamed from compiler/typecheck/TcErrors.hs)54
-rw-r--r--compiler/GHC/Tc/Errors/Hole.hs (renamed from compiler/typecheck/TcHoleErrors.hs)52
-rw-r--r--compiler/GHC/Tc/Errors/Hole.hs-boot13
-rw-r--r--compiler/GHC/Tc/Errors/Hole/FitTypes.hs (renamed from compiler/typecheck/TcHoleFitTypes.hs)8
-rw-r--r--compiler/GHC/Tc/Errors/Hole/FitTypes.hs-boot10
-rw-r--r--compiler/GHC/Tc/Gen/Annotation.hs (renamed from compiler/typecheck/TcAnnotations.hs)8
-rw-r--r--compiler/GHC/Tc/Gen/Arrow.hs (renamed from compiler/typecheck/TcArrows.hs)32
-rw-r--r--compiler/GHC/Tc/Gen/Bind.hs (renamed from compiler/typecheck/TcBinds.hs)67
-rw-r--r--compiler/GHC/Tc/Gen/Default.hs (renamed from compiler/typecheck/TcDefaults.hs)18
-rw-r--r--compiler/GHC/Tc/Gen/Export.hs (renamed from compiler/typecheck/TcRnExports.hs)15
-rw-r--r--compiler/GHC/Tc/Gen/Expr.hs (renamed from compiler/typecheck/TcExpr.hs)93
-rw-r--r--compiler/GHC/Tc/Gen/Expr.hs-boot (renamed from compiler/typecheck/TcExpr.hs-boot)12
-rw-r--r--compiler/GHC/Tc/Gen/Foreign.hs (renamed from compiler/typecheck/TcForeign.hs)36
-rw-r--r--compiler/GHC/Tc/Gen/HsType.hs (renamed from compiler/typecheck/TcHsType.hs)94
-rw-r--r--compiler/GHC/Tc/Gen/Match.hs (renamed from compiler/typecheck/TcMatches.hs)54
-rw-r--r--compiler/GHC/Tc/Gen/Match.hs-boot (renamed from compiler/typecheck/TcMatches.hs-boot)8
-rw-r--r--compiler/GHC/Tc/Gen/Pat.hs (renamed from compiler/typecheck/TcPat.hs)52
-rw-r--r--compiler/GHC/Tc/Gen/Rule.hs (renamed from compiler/typecheck/TcRules.hs)43
-rw-r--r--compiler/GHC/Tc/Gen/Sig.hs (renamed from compiler/typecheck/TcSigs.hs)44
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs (renamed from compiler/typecheck/TcSplice.hs)45
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs-boot (renamed from compiler/typecheck/TcSplice.hs-boot)8
-rw-r--r--compiler/GHC/Tc/Instance/Class.hs (renamed from compiler/typecheck/ClsInst.hs)34
-rw-r--r--compiler/GHC/Tc/Instance/Family.hs (renamed from compiler/typecheck/FamInst.hs)15
-rw-r--r--compiler/GHC/Tc/Instance/FunDeps.hs (renamed from compiler/typecheck/FunDeps.hs)24
-rw-r--r--compiler/GHC/Tc/Instance/Typeable.hs (renamed from compiler/typecheck/TcTypeable.hs)18
-rw-r--r--compiler/GHC/Tc/Module.hs (renamed from compiler/typecheck/TcRnDriver.hs)88
-rw-r--r--compiler/GHC/Tc/Module.hs-boot (renamed from compiler/typecheck/TcRnDriver.hs-boot)4
-rw-r--r--compiler/GHC/Tc/Plugin.hs (renamed from compiler/typecheck/TcPluginM.hs)40
-rw-r--r--compiler/GHC/Tc/Solver.hs (renamed from compiler/typecheck/TcSimplify.hs)96
-rw-r--r--compiler/GHC/Tc/Solver/Canonical.hs (renamed from compiler/typecheck/TcCanonical.hs)72
-rw-r--r--compiler/GHC/Tc/Solver/Flatten.hs (renamed from compiler/typecheck/TcFlatten.hs)40
-rw-r--r--compiler/GHC/Tc/Solver/Interact.hs (renamed from compiler/typecheck/TcInteract.hs)60
-rw-r--r--compiler/GHC/Tc/Solver/Monad.hs (renamed from compiler/typecheck/TcSMonad.hs)90
-rw-r--r--compiler/GHC/Tc/TyCl.hs (renamed from compiler/typecheck/TcTyClsDecls.hs)95
-rw-r--r--compiler/GHC/Tc/TyCl/Build.hs (renamed from compiler/iface/BuildTyCl.hs)8
-rw-r--r--compiler/GHC/Tc/TyCl/Class.hs (renamed from compiler/typecheck/TcClassDcl.hs)52
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs (renamed from compiler/typecheck/TcInstDcls.hs)80
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs-boot (renamed from compiler/typecheck/TcInstDcls.hs-boot)10
-rw-r--r--compiler/GHC/Tc/TyCl/PatSyn.hs (renamed from compiler/typecheck/TcPatSyn.hs)46
-rw-r--r--compiler/GHC/Tc/TyCl/PatSyn.hs-boot (renamed from compiler/typecheck/TcPatSyn.hs-boot)6
-rw-r--r--compiler/GHC/Tc/TyCl/Utils.hs (renamed from compiler/typecheck/TcTyDecls.hs)23
-rw-r--r--compiler/GHC/Tc/Types.hs (renamed from compiler/typecheck/TcRnTypes.hs)78
-rw-r--r--compiler/GHC/Tc/Types.hs-boot (renamed from compiler/typecheck/TcRnTypes.hs-boot)4
-rw-r--r--compiler/GHC/Tc/Types/Constraint.hs (renamed from compiler/typecheck/Constraint.hs)81
-rw-r--r--compiler/GHC/Tc/Types/EvTerm.hs (renamed from compiler/typecheck/TcEvTerm.hs)10
-rw-r--r--compiler/GHC/Tc/Types/Evidence.hs (renamed from compiler/typecheck/TcEvidence.hs)24
-rw-r--r--compiler/GHC/Tc/Types/Origin.hs (renamed from compiler/typecheck/TcOrigin.hs)27
-rw-r--r--compiler/GHC/Tc/Utils/Backpack.hs (renamed from compiler/typecheck/TcBackpack.hs)35
-rw-r--r--compiler/GHC/Tc/Utils/Env.hs (renamed from compiler/typecheck/TcEnv.hs)16
-rw-r--r--compiler/GHC/Tc/Utils/Env.hs-boot10
-rw-r--r--compiler/GHC/Tc/Utils/Instantiate.hs (renamed from compiler/typecheck/Inst.hs)33
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs (renamed from compiler/typecheck/TcRnMonad.hs)26
-rw-r--r--compiler/GHC/Tc/Utils/TcMType.hs (renamed from compiler/typecheck/TcMType.hs)71
-rw-r--r--compiler/GHC/Tc/Utils/TcType.hs (renamed from compiler/typecheck/TcType.hs)62
-rw-r--r--compiler/GHC/Tc/Utils/TcType.hs-boot (renamed from compiler/typecheck/TcType.hs-boot)2
-rw-r--r--compiler/GHC/Tc/Utils/Unify.hs (renamed from compiler/typecheck/TcUnify.hs)47
-rw-r--r--compiler/GHC/Tc/Utils/Unify.hs-boot (renamed from compiler/typecheck/TcUnify.hs-boot)10
-rw-r--r--compiler/GHC/Tc/Utils/Zonk.hs (renamed from compiler/typecheck/TcHsSyn.hs)42
-rw-r--r--compiler/GHC/Tc/Validity.hs (renamed from compiler/typecheck/TcValidity.hs)58
-rw-r--r--compiler/GHC/ThToHs.hs6
-rw-r--r--compiler/GHC/Types/Id/Info.hs2
-rw-r--r--compiler/GHC/Types/Id/Make.hs12
-rw-r--r--compiler/GHC/Types/Name/Occurrence.hs6
-rw-r--r--compiler/GHC/Types/Name/Reader.hs2
-rw-r--r--compiler/GHC/Types/Name/Shape.hs6
-rw-r--r--compiler/GHC/Types/Var.hs6
-rw-r--r--compiler/flattening-notes (renamed from compiler/typecheck/Flattening-notes)0
-rw-r--r--compiler/ghc.cabal.in112
-rw-r--r--compiler/main/StaticPtrTable.hs4
-rw-r--r--compiler/parser/Lexer.x2
-rw-r--r--compiler/parser/Parser.y15
-rw-r--r--compiler/prelude/PrelNames.hs8
-rw-r--r--compiler/prelude/TysPrim.hs6
-rw-r--r--compiler/prelude/TysWiredIn.hs4
-rw-r--r--compiler/typecheck/TcEnv.hs-boot10
-rw-r--r--compiler/typecheck/TcHoleErrors.hs-boot13
-rw-r--r--compiler/typecheck/TcHoleFitTypes.hs-boot10
-rw-r--r--compiler/typecheck/TcTypeNats.hs4
-rw-r--r--compiler/utils/MonadUtils.hs2
-rw-r--r--docs/core-spec/CoreLint.ott6
-rw-r--r--docs/core-spec/core-spec.mng2
-rw-r--r--docs/ghci/ghci.tex2
-rw-r--r--docs/users_guide/extending_ghc.rst8
-rw-r--r--ghc/GHCi/UI.hs4
-rw-r--r--ghc/GHCi/UI/Info.hs2
-rw-r--r--ghc/Main.hs2
-rw-r--r--libraries/base/Data/Typeable/Internal.hs4
-rw-r--r--libraries/base/GHC/OverloadedLabels.hs2
-rw-r--r--libraries/base/GHC/Ptr.hs2
-rw-r--r--libraries/base/GHC/Read.hs2
-rw-r--r--libraries/base/Unsafe/Coerce.hs2
-rw-r--r--libraries/ghc-prim/GHC/Types.hs4
-rw-r--r--libraries/ghci/GHCi/TH.hs9
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs2
-rw-r--r--testsuite/tests/dependent/should_compile/T16344b.hs2
-rw-r--r--testsuite/tests/dependent/should_fail/T16344a.hs2
-rw-r--r--testsuite/tests/deriving/should_compile/deriving-1935.hs2
-rw-r--r--testsuite/tests/deriving/should_compile/drv003.hs2
-rw-r--r--testsuite/tests/deriving/should_compile/drv015.hs2
-rw-r--r--testsuite/tests/gadt/gadt9.hs2
-rw-r--r--testsuite/tests/ghc-api/T4891/T4891.hs6
-rw-r--r--testsuite/tests/ghci/should_run/tc-plugin-ghci/TcPluginGHCi.hs2
-rw-r--r--testsuite/tests/indexed-types/should_compile/T2238.hs2
-rw-r--r--testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs2
-rw-r--r--testsuite/tests/package/package07e.stderr10
-rw-r--r--testsuite/tests/package/package08e.stderr10
-rw-r--r--testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs6
-rw-r--r--testsuite/tests/plugins/hooks-plugin/Hooks/Plugin.hs2
-rw-r--r--testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs2
-rw-r--r--testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs2
-rw-r--r--testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs2
-rw-r--r--testsuite/tests/plugins/static-plugins.hs2
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11195.hs2
-rw-r--r--testsuite/tests/polykinds/CuskFam.hs2
-rw-r--r--testsuite/tests/polykinds/TyVarTvKinds.hs2
-rw-r--r--testsuite/tests/programs/record_upd/Main.hs2
-rw-r--r--testsuite/tests/roles/should_compile/Roles2.hs2
-rw-r--r--testsuite/tests/simplCore/should_compile/T5776.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/DfltProb2.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/Improvement.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/T11462_Plugin.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/T11525_Plugin.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc079.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc101.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc129.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc157.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc161.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc176.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc178.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc200.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc228.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc231.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/T16512b.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail093.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail098.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail142.hs2
-rw-r--r--testsuite/tests/typecheck/should_run/tcrun021.hs2
-rw-r--r--utils/genprimopcode/Main.hs2
m---------utils/haddock0
243 files changed, 1850 insertions, 1811 deletions
diff --git a/CODEOWNERS b/CODEOWNERS
index 6e7c0931b9..cbbb76de98 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -16,26 +16,26 @@
/includes/ @bgamari @simonmar @osa1
# The compiler
-/compiler/parser/ @int-index
-/compiler/hsSyn/ @simonpj @rae
-/compiler/typecheck/ @simonpj @rae
-/compiler/rename/ @simonpj @rae
-/compiler/types/ @simonpj @rae
-/compiler/deSugar/ @simonpj @rae
-/compiler/typecheck/TcDeriv* @RyanGlScott
-/compiler/nativeGen/ @simonmar @bgamari @AndreasK
-/compiler/llvmGen/ @angerman
-/compiler/codeGen/ @simonmar @osa1
-/compiler/cmm/ @simonmar @osa1
-/compiler/ghci/ @simonmar
-/compiler/simplCore/CallArity.hs @nomeata
-/compiler/utils/UnVarGraph.hs @nomeata
-/compiler/simplCore/Exitify.hs @nomeata
-/compiler/simplStg/StgCse.hs @nomeata
-/compiler/simplStg/StgLiftLams.hs @sgraf
-/compiler/cmm/CmmSwitch.hs @nomeata
-/compiler/stranal/DmdAnal.hs @simonpj @sgraf
-/compiler/hsSyn/Convert.hs @rae
+/compiler/parser/ @int-index
+/compiler/GHC/Hs/ @simonpj @rae
+/compiler/GHC/Tc/ @simonpj @rae
+/compiler/GHC/Rename/ @simonpj @rae
+/compiler/GHC/Types/ @simonpj @rae
+/compiler/GHC/HsToCore/ @simonpj @rae
+/compiler/GHC/Tc/Deriv/ @RyanGlScott
+/compiler/GHC/CmmToAsm/ @simonmar @bgamari @AndreasK
+/compiler/GHC/CmmToLlvm/ @angerman
+/compiler/GHC/StgToCmm/ @simonmar @osa1
+/compiler/GHC/Cmm/ @simonmar @osa1
+/compiler/ghci/ @simonmar
+/compiler/GHC/Core/Op/CallArity.hs @nomeata
+/compiler/utils/UnVarGraph.hs @nomeata
+/compiler/GHC/Core/Op/Exitify.hs @nomeata
+/compiler/GHC/Stg/CSE.hs @nomeata
+/compiler/GHC/Stg/Lift.hs @sgraf
+/compiler/GHC/Cmm/Switch.hs @nomeata
+/compiler/GHC/Core/Op/DmdAnal.hs @simonpj @sgraf
+/compiler/GHC/ThToHs.hs @rae
# Core libraries
/libraries/base/ @hvr
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 4c61779602..1682f1685e 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -308,16 +308,16 @@ import GHC.Driver.Make
import GHC.Driver.Hooks
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
-import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
-import GHC.Iface.Load ( loadSysInterface )
-import TcRnTypes
+import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
+import GHC.Iface.Load ( loadSysInterface )
+import GHC.Tc.Types
import GHC.Core.Predicate
import GHC.Driver.Packages
import GHC.Types.Name.Set
import GHC.Types.Name.Reader
import GHC.Hs
import GHC.Core.Type hiding( typeKind )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Types.Id
import TysPrim ( alphaTyVars )
import GHC.Core.TyCon
@@ -357,9 +357,9 @@ import Lexer
import ApiAnnotation
import qualified GHC.LanguageExtensions as LangExt
import GHC.Types.Name.Env
-import TcRnDriver
-import Inst
-import FamInst
+import GHC.Tc.Module
+import GHC.Tc.Utils.Instantiate
+import GHC.Tc.Instance.Family
import FileCleanup
import Data.Foldable
@@ -1322,7 +1322,7 @@ getNameToInstancesIndex visible_mods mods_to_load = do
; (pkg_fie, home_fie) <- tcGetFamInstEnvs
-- We use Data.Sequence.Seq because we are creating left associated
-- mappends.
- -- cls_index and fam_index below are adapted from TcRnDriver.lookupInsts
+ -- cls_index and fam_index below are adapted from GHC.Tc.Module.lookupInsts
; let cls_index = Map.fromListWith mappend
[ (n, Seq.singleton ispec)
| ispec <- instEnvElts ie_local ++ instEnvElts ie_global
diff --git a/compiler/GHC/Cmm/Expr.hs b/compiler/GHC/Cmm/Expr.hs
index 1600588e2c..bb3fe2e202 100644
--- a/compiler/GHC/Cmm/Expr.hs
+++ b/compiler/GHC/Cmm/Expr.hs
@@ -368,7 +368,7 @@ instance Ord r => DefinerOfRegs r r where
instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r CmmExpr where
-- The (Ord r) in the context is necessary here
- -- See Note [Recursive superclasses] in TcInstDcls
+ -- See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance
foldRegsUsed dflags f !z e = expr z e
where expr z (CmmLit _) = z
expr z (CmmLoad addr _) = foldRegsUsed dflags f z addr
diff --git a/compiler/GHC/Cmm/Node.hs b/compiler/GHC/Cmm/Node.hs
index 98314a8da3..d5d020ee00 100644
--- a/compiler/GHC/Cmm/Node.hs
+++ b/compiler/GHC/Cmm/Node.hs
@@ -348,7 +348,7 @@ instance UserOfRegs GlobalReg (CmmNode e x) where
instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r ForeignTarget where
-- The (Ord r) in the context is necessary here
- -- See Note [Recursive superclasses] in TcInstDcls
+ -- See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance
foldRegsUsed _ _ !z (PrimTarget _) = z
foldRegsUsed dflags f !z (ForeignTarget e _) = foldRegsUsed dflags f z e
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index b8d44d98a0..af06c1043d 100644
--- a/compiler/GHC/Core.hs
+++ b/compiler/GHC/Core.hs
@@ -537,7 +537,7 @@ substitutions until the next run of the simplifier.
case (df @Int) of (co :: a ~# b) -> blah
Which is very exotic, and I think never encountered; but see
Note [Equality superclasses in quantified constraints]
- in TcCanonical
+ in GHC.Tc.Solver.Canonical
Note [Core case invariants]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/GHC/Core/Arity.hs b/compiler/GHC/Core/Arity.hs
index 23e2eaf734..9d1adab519 100644
--- a/compiler/GHC/Core/Arity.hs
+++ b/compiler/GHC/Core/Arity.hs
@@ -191,7 +191,7 @@ Note [Newtype classes and eta expansion]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NB: this nasty special case is no longer required, because
for newtype classes we don't use the class-op rule mechanism
- at all. See Note [Single-method classes] in TcInstDcls. SLPJ May 2013
+ at all. See Note [Single-method classes] in GHC.Tc.TyCl.Instance. SLPJ May 2013
-------- Old out of date comments, just for interest -----------
We have to be careful when eta-expanding through newtypes. In general
diff --git a/compiler/GHC/Core/Class.hs b/compiler/GHC/Core/Class.hs
index 454f7015dd..7b73f3a423 100644
--- a/compiler/GHC/Core/Class.hs
+++ b/compiler/GHC/Core/Class.hs
@@ -222,7 +222,7 @@ we should make sure that the first and third args match the instance
header.
Having the same variables for class and tycon is also used in checkValidRoles
-(in TcTyClsDecls) when checking a class's roles.
+(in GHC.Tc.TyCl) when checking a class's roles.
************************************************************************
diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs
index ea9a21d2aa..8e5e9f53ec 100644
--- a/compiler/GHC/Core/Coercion.hs
+++ b/compiler/GHC/Core/Coercion.hs
@@ -207,7 +207,7 @@ pprCoAxiom ax@(CoAxiom { co_ax_tc = tc, co_ax_branches = branches })
pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc
-- Used when printing injectivity errors (FamInst.reportInjectivityErrors)
--- and inaccessible branches (TcValidity.inaccessibleCoAxBranch)
+-- and inaccessible branches (GHC.Tc.Validity.inaccessibleCoAxBranch)
-- This happens in error messages: don't print the RHS of a data
-- family axiom, which is meaningless to a user
pprCoAxBranchUser tc br
@@ -2524,7 +2524,7 @@ buildCoercion orig_ty1 orig_ty2 = go orig_ty1 orig_ty2
%* *
%************************************************************************
-The function below morally belongs in TcFlatten, but it is used also in
+The function below morally belongs in GHC.Tc.Solver.Flatten, but it is used also in
FamInstEnv, and so lives here.
Note [simplifyArgsWorker]
@@ -2838,7 +2838,7 @@ simplifyArgsWorker orig_ki_binders orig_inner_ki orig_fvs
kind_co = liftCoSubst Nominal lc final_kind
go acc_xis acc_cos lc (binder:binders) inner_ki (role:roles) ((xi,co):args)
- = -- By Note [Flattening] in TcFlatten invariant (F2),
+ = -- By Note [Flattening] in GHC.Tc.Solver.Flatten invariant (F2),
-- tcTypeKind(xi) = tcTypeKind(ty). But, it's possible that xi will be
-- used as an argument to a function whose kind is different, if
-- earlier arguments have been flattened to new types. We thus
@@ -2898,7 +2898,7 @@ simplifyArgsWorker orig_ki_binders orig_inner_ki orig_fvs
-- This debug information is commented out because leaving it in
-- causes a ~2% increase in allocations in T9872d.
-- That's independent of the analogous case in flatten_args_fast
- -- in TcFlatten:
+ -- in GHC.Tc.Solver.Flatten:
-- each of these causes a 2% increase on its own, so commenting them
-- both out gives a 4% decrease in T9872d.
{-
diff --git a/compiler/GHC/Core/Coercion/Axiom.hs b/compiler/GHC/Core/Coercion/Axiom.hs
index 5dd99a4ac1..7f38b3dcd6 100644
--- a/compiler/GHC/Core/Coercion/Axiom.hs
+++ b/compiler/GHC/Core/Coercion/Axiom.hs
@@ -240,7 +240,7 @@ data CoAxBranch
, cab_cvs :: [CoVar] -- Bound coercion variables
-- Always empty, for now.
-- See Note [Constraints in patterns]
- -- in TcTyClsDecls
+ -- in GHC.Tc.TyCl
, cab_roles :: [Role] -- See Note [CoAxBranch roles]
, cab_lhs :: [Type] -- Type patterns to match against
, cab_rhs :: Type -- Right-hand side of the equality
@@ -427,7 +427,7 @@ TyCon rep_tc:
- This eta reduction happens for data instances as well
as newtype instances. Here we want to eta-reduce the data family axiom.
- - This eta-reduction is done in TcInstDcls.tcDataFamInstDecl.
+ - This eta-reduction is done in GHC.Tc.TyCl.Instance.tcDataFamInstDecl.
But for a /type/ family
- cab_lhs has the exact arity of the family tycon
diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs
index c5de884963..dca2f90c34 100644
--- a/compiler/GHC/Core/Coercion/Opt.hs
+++ b/compiler/GHC/Core/Coercion/Opt.hs
@@ -13,7 +13,7 @@ import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Subst
import GHC.Core.Coercion
import GHC.Core.Type as Type hiding( substTyVarBndr, substTy )
-import TcType ( exactTyCoVarsOfType )
+import GHC.Tc.Utils.TcType ( exactTyCoVarsOfType )
import GHC.Core.TyCon
import GHC.Core.Coercion.Axiom
import GHC.Types.Var.Set
diff --git a/compiler/GHC/Core/FamInstEnv.hs b/compiler/GHC/Core/FamInstEnv.hs
index 0b58195be6..51ac348233 100644
--- a/compiler/GHC/Core/FamInstEnv.hs
+++ b/compiler/GHC/Core/FamInstEnv.hs
@@ -863,7 +863,7 @@ conditions hold:
of last equation and check whether it is overlapped by any of previous
equations. Since it is overlapped by the first equation we conclude
that pair of last two equations does not violate injectivity
- annotation. (Check done in TcValidity.checkValidCoAxiom#gather_conflicts)
+ annotation. (Check done in GHC.Tc.Validity.checkValidCoAxiom#gather_conflicts)
A special case of B is when RHSs unify with an empty substitution ie. they
are identical.
@@ -898,7 +898,7 @@ conditions hold:
injective. "Injective position" means either an argument to a type
constructor or argument to a type family on injective position.
There are subtleties here. See Note [Coverage condition for injective type families]
- in FamInst.
+ in GHC.Tc.Instance.Family.
Check (1) must be done for all family instances (transitively) imported. Other
checks (2-4) should be done just for locally written equations, as they are checks
@@ -1189,7 +1189,7 @@ findBranch branches target_tys
apartnessCheck :: [Type] -- ^ /flattened/ target arguments. Make sure
-- they're flattened! See Note [Flattening].
-- (NB: This "flat" is a different
- -- "flat" than is used in TcFlatten.)
+ -- "flat" than is used in GHC.Tc.Solver.Flatten.)
-> CoAxBranch -- ^ the candidate equation we wish to use
-- Precondition: this matches the target
-> Bool -- ^ True <=> equation can fire
@@ -1445,7 +1445,7 @@ normalise_type ty
go_app_tys :: Type -- function
-> [Type] -- args
-> NormM (Coercion, Type)
- -- cf. TcFlatten.flatten_app_ty_args
+ -- cf. GHC.Tc.Solver.Flatten.flatten_app_ty_args
go_app_tys (AppTy ty1 ty2) tys = go_app_tys ty1 (ty2 : tys)
go_app_tys fun_ty arg_tys
= do { (fun_co, nfun) <- go fun_ty
@@ -1476,7 +1476,7 @@ normalise_args :: Kind -- of the function
-- and the res_co :: kind(f orig_args) ~ kind(f xis)
-- NB: The xis might *not* have the same kinds as the input types,
-- but the resulting application *will* be well-kinded
--- cf. TcFlatten.flatten_args_slow
+-- cf. GHC.Tc.Solver.Flatten.flatten_args_slow
normalise_args fun_ki roles args
= do { normed_args <- zipWithM normalise1 roles args
; let (xis, cos, res_co) = simplifyArgsWorker ki_binders inner_ki fvs roles normed_args
diff --git a/compiler/GHC/Core/InstEnv.hs b/compiler/GHC/Core/InstEnv.hs
index 7fcea8433e..b32d1aa150 100644
--- a/compiler/GHC/Core/InstEnv.hs
+++ b/compiler/GHC/Core/InstEnv.hs
@@ -4,7 +4,7 @@
\section[InstEnv]{Utilities for typechecking instance declarations}
-The bits common to TcInstDcls and TcDeriv.
+The bits common to GHC.Tc.TyCl.Instance and GHC.Tc.Deriv.
-}
{-# LANGUAGE CPP, DeriveDataTypeable #-}
@@ -33,7 +33,7 @@ module GHC.Core.InstEnv (
import GhcPrelude
-import TcType -- InstEnv is really part of the type checker,
+import GHC.Tc.Utils.TcType -- InstEnv is really part of the type checker,
-- and depends on TcType in many ways
import GHC.Core ( IsOrphan(..), isOrphan, chooseOrphanAnchor )
import GHC.Types.Module
@@ -453,7 +453,7 @@ classInstances (InstEnvs { ie_global = pkg_ie, ie_local = home_ie, ie_visible =
Nothing -> []
-- | Checks for an exact match of ClsInst in the instance environment.
--- We use this when we do signature checking in TcRnDriver
+-- We use this when we do signature checking in GHC.Tc.Module
memberInstEnv :: InstEnv -> ClsInst -> Bool
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
maybe False (\(ClsIE items) -> any (identicalDFunType ins_item) items)
@@ -732,7 +732,7 @@ type ClsInstLookupResult
, [ClsInst] -- These don't match but do unify
, [InstMatch] ) -- Unsafe overlapped instances under Safe Haskell
-- (see Note [Safe Haskell Overlapping Instances] in
- -- TcSimplify).
+ -- GHC.Tc.Solver).
{-
Note [DFunInstType: instantiating types]
@@ -835,8 +835,8 @@ lookupInstEnv :: Bool -- Check Safe Haskell overlap restrictions
-> Class -> [Type] -- What we are looking for
-> ClsInstLookupResult
-- ^ See Note [Rules for instance lookup]
--- ^ See Note [Safe Haskell Overlapping Instances] in TcSimplify
--- ^ See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
+-- ^ See Note [Safe Haskell Overlapping Instances] in GHC.Tc.Solver
+-- ^ See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
lookupInstEnv check_overlap_safe
(InstEnvs { ie_global = pkg_ie
, ie_local = home_ie
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index 3aeb05700c..765b55ffbf 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -35,7 +35,7 @@ import GHC.Types.Literal
import GHC.Core.DataCon
import TysWiredIn
import TysPrim
-import TcType ( isFloatingTy )
+import GHC.Tc.Utils.TcType ( isFloatingTy )
import GHC.Types.Var as Var
import GHC.Types.Var.Env
import GHC.Types.Var.Set
@@ -440,7 +440,7 @@ interactiveInScope :: HscEnv -> [Var]
interactiveInScope hsc_env
= tyvars ++ ids
where
- -- C.f. TcRnDriver.setInteractiveContext, Desugar.deSugarExpr
+ -- C.f. GHC.Tc.Module.setInteractiveContext, Desugar.deSugarExpr
ictxt = hsc_IC hsc_env
(cls_insts, _fam_insts) = ic_instances ictxt
te1 = mkTypeEnvWithImplicits (ic_tythings ictxt)
@@ -1491,7 +1491,7 @@ Here 'cls' appears free in b's kind, which would usually be illegal
#in this case (Alg cls *) = *, so all is well. Currently we allow
this, and make Lint expand synonyms where necessary to make it so.
-c.f. TcUnify.occCheckExpand and GHC.Core.Utils.coreAltsType which deal
+c.f. GHC.Tc.Utils.Unify.occCheckExpand and GHC.Core.Utils.coreAltsType which deal
with the same problem. A single systematic solution eludes me.
-}
@@ -1499,7 +1499,7 @@ with the same problem. A single systematic solution eludes me.
lintTySynFamApp :: Bool -> Type -> TyCon -> [Type] -> LintM LintedKind
-- The TyCon is a type synonym or a type family (not a data family)
-- See Note [Linting type synonym applications]
--- c.f. TcValidity.check_syn_tc_app
+-- c.f. GHC.Tc.Validity.check_syn_tc_app
lintTySynFamApp report_unsat ty tc tys
| report_unsat -- Report unsaturated only if report_unsat is on
, tys `lengthLessThan` tyConArity tc
diff --git a/compiler/GHC/Core/Op/CSE.hs b/compiler/GHC/Core/Op/CSE.hs
index 790e9b97d3..71187e6b6e 100644
--- a/compiler/GHC/Core/Op/CSE.hs
+++ b/compiler/GHC/Core/Op/CSE.hs
@@ -534,7 +534,7 @@ version:
We had to revert this patch because it made GHC itself slower.
Why? It delayed inlining of /all/ functions with RULES, and that was
-very bad in TcFlatten.flatten_ty_con_app
+very bad in GHC.Tc.Solver.Flatten.flatten_ty_con_app
* It delayed inlining of liftM
* That delayed the unravelling of the recursion in some dictionary
diff --git a/compiler/GHC/Core/Op/OccurAnal.hs b/compiler/GHC/Core/Op/OccurAnal.hs
index 997ff7dd5a..0bc3cb720a 100644
--- a/compiler/GHC/Core/Op/OccurAnal.hs
+++ b/compiler/GHC/Core/Op/OccurAnal.hs
@@ -1100,7 +1100,7 @@ inline 'f' in '$wf'.
Note [DFuns should not be loop breakers]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's particularly bad to make a DFun into a loop breaker. See
-Note [How instance declarations are translated] in TcInstDcls
+Note [How instance declarations are translated] in GHC.Tc.TyCl.Instance
We give DFuns a higher score than ordinary CONLIKE things because
if there's a choice we want the DFun to be the non-loop breaker. Eg
@@ -2914,7 +2914,7 @@ from making it a join point.
If it is recursive, and uselessly marked INLINE, this will stop us
making it a join point, which is annoying. But occasionally
(notably in class methods; see Note [Instances and loop breakers] in
-TcInstDcls) we mark recursive things as INLINE but the recursion
+GHC.Tc.TyCl.Instance) we mark recursive things as INLINE but the recursion
unravels; so ignoring INLINE pragmas on recursive things isn't good
either.
diff --git a/compiler/GHC/Core/Op/Simplify.hs b/compiler/GHC/Core/Op/Simplify.hs
index fcf2eaf168..0227ee9cf0 100644
--- a/compiler/GHC/Core/Op/Simplify.hs
+++ b/compiler/GHC/Core/Op/Simplify.hs
@@ -3554,7 +3554,7 @@ simplStableUnfolding env top_lvl mb_cont id unf rhs_ty
-- Refresh the boring-ok flag, in case expr'
-- has got small. This happens, notably in the inlinings
-- for dfuns for single-method classes; see
- -- Note [Single-method classes] in TcInstDcls.
+ -- Note [Single-method classes] in GHC.Tc.TyCl.Instance.
-- A test case is #4138
-- But retain a previous boring_ok of True; e.g. see
-- the way it is set in calcUnfoldingGuidanceWithArity
diff --git a/compiler/GHC/Core/Op/Specialise.hs b/compiler/GHC/Core/Op/Specialise.hs
index dfc115fd6b..a99886d8c6 100644
--- a/compiler/GHC/Core/Op/Specialise.hs
+++ b/compiler/GHC/Core/Op/Specialise.hs
@@ -16,7 +16,7 @@ module GHC.Core.Op.Specialise ( specProgram, specUnfolding ) where
import GhcPrelude
import GHC.Types.Id
-import TcType hiding( substTy )
+import GHC.Tc.Utils.TcType hiding( substTy )
import GHC.Core.Type hiding( substTy, extendTvSubstList )
import GHC.Core.Predicate
import GHC.Types.Module( Module, HasModule(..) )
diff --git a/compiler/GHC/Core/PatSyn.hs b/compiler/GHC/Core/PatSyn.hs
index cf2aaf1ad0..39e91795d6 100644
--- a/compiler/GHC/Core/PatSyn.hs
+++ b/compiler/GHC/Core/PatSyn.hs
@@ -295,12 +295,12 @@ would be a top-level declaration with an unboxed type.
This means that when typechecking an occurrence of P in an expression,
we must remember that the builder has this void argument. This is
-done by TcPatSyn.patSynBuilderOcc.
+done by GHC.Tc.TyCl.PatSyn.patSynBuilderOcc.
Note [Pattern synonyms and the data type Type]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The type of a pattern synonym is of the form (See Note
-[Pattern synonym signatures] in TcSigs):
+[Pattern synonym signatures] in GHC.Tc.Gen.Sig):
forall univ_tvs. req => forall ex_tvs. prov => ...
diff --git a/compiler/GHC/Core/Predicate.hs b/compiler/GHC/Core/Predicate.hs
index b57278fba2..c9894655f7 100644
--- a/compiler/GHC/Core/Predicate.hs
+++ b/compiler/GHC/Core/Predicate.hs
@@ -51,7 +51,7 @@ data Pred
| EqPred EqRel Type Type
| IrredPred PredType
| ForAllPred [TyVar] [PredType] PredType
- -- ForAllPred: see Note [Quantified constraints] in TcCanonical
+ -- ForAllPred: see Note [Quantified constraints] in GHC.Tc.Solver.Canonical
-- NB: There is no TuplePred case
-- Tuple predicates like (Eq a, Ord b) are just treated
-- as ClassPred, as if we had a tuple class with two superclasses
@@ -144,7 +144,7 @@ Predicates on PredType
{-
Note [Evidence for quantified constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The superclass mechanism in TcCanonical.makeSuperClasses risks
+The superclass mechanism in GHC.Tc.Solver.Canonical.makeSuperClasses risks
taking a quantified constraint like
(forall a. C a => a ~ b)
and generate superclass evidence
@@ -153,7 +153,7 @@ and generate superclass evidence
This is a funny thing: neither isPredTy nor isCoVarType are true
of it. So we are careful not to generate it in the first place:
see Note [Equality superclasses in quantified constraints]
-in TcCanonical.
+in GHC.Tc.Solver.Canonical.
-}
isEvVarType :: Type -> Bool
diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs
index dc2b203645..29953026ef 100644
--- a/compiler/GHC/Core/Rules.hs
+++ b/compiler/GHC/Core/Rules.hs
@@ -34,19 +34,19 @@ import GHC.Core -- All of it
import GHC.Types.Module ( Module, ModuleSet, elemModuleSet )
import GHC.Core.Subst
import GHC.Core.SimpleOpt ( exprIsLambda_maybe )
-import GHC.Core.FVs ( exprFreeVars, exprsFreeVars, bindFreeVars
- , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList )
-import GHC.Core.Utils ( exprType, eqExpr, mkTick, mkTicks
- , stripTicksTopT, stripTicksTopE
- , isJoinBind )
-import GHC.Core.Ppr ( pprRules )
+import GHC.Core.FVs ( exprFreeVars, exprsFreeVars, bindFreeVars
+ , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList )
+import GHC.Core.Utils ( exprType, eqExpr, mkTick, mkTicks
+ , stripTicksTopT, stripTicksTopE
+ , isJoinBind )
+import GHC.Core.Ppr ( pprRules )
import GHC.Core.Type as Type
( Type, TCvSubst, extendTvSubst, extendCvSubst
, mkEmptyTCvSubst, substTy )
-import TcType ( tcSplitTyConApp_maybe )
-import TysWiredIn ( anyTypeOfKind )
+import GHC.Tc.Utils.TcType ( tcSplitTyConApp_maybe )
+import TysWiredIn ( anyTypeOfKind )
import GHC.Core.Coercion as Coercion
-import GHC.Core.Op.Tidy ( tidyRules )
+import GHC.Core.Op.Tidy ( tidyRules )
import GHC.Types.Id
import GHC.Types.Id.Info ( RuleInfo( RuleInfo ) )
import GHC.Types.Var
@@ -972,7 +972,7 @@ match_ty :: RuleMatchEnv
-> Type -- Template
-> Type -- Target
-> Maybe RuleSubst
--- Matching Core types: use the matcher in TcType.
+-- Matching Core types: use the matcher in GHC.Tc.Utils.TcType.
-- Notice that we treat newtypes as opaque. For example, suppose
-- we have a specialised version of a function at a newtype, say
-- newtype T = MkT Int
diff --git a/compiler/GHC/Core/TyCo/FVs.hs b/compiler/GHC/Core/TyCo/FVs.hs
index 30d16c1faf..3c4246750f 100644
--- a/compiler/GHC/Core/TyCo/FVs.hs
+++ b/compiler/GHC/Core/TyCo/FVs.hs
@@ -775,7 +775,7 @@ almost_devoid_co_var_of_types (ty:tys) cv
-- See @Note [When does a tycon application need an explicit kind signature?]@.
injectiveVarsOfType :: Bool -- ^ Should we look under injective type families?
-- See Note [Coverage condition for injective type families]
- -- in FamInst.
+ -- in GHC.Tc.Instance.Family.
-> Type -> FV
injectiveVarsOfType look_under_tfs = go
where
@@ -810,7 +810,7 @@ injectiveVarsOfType look_under_tfs = go
-- See @Note [When does a tycon application need an explicit kind signature?]@.
injectiveVarsOfTypes :: Bool -- ^ look under injective type families?
-- See Note [Coverage condition for injective type families]
- -- in FamInst.
+ -- in GHC.Tc.Instance.Family.
-> [Type] -> FV
injectiveVarsOfTypes look_under_tfs = mapUnionFV (injectiveVarsOfType look_under_tfs)
@@ -933,7 +933,7 @@ types/kinds are fully settled and zonked.
--
-- It is also meant to be stable: that is, variables should not
-- be reordered unnecessarily. This is specified in Note [ScopedSort]
--- See also Note [Ordering of implicit variables] in GHC.Rename.Types
+-- See also Note [Ordering of implicit variables] in GHC.Rename.HsType
scopedSort :: [TyCoVar] -> [TyCoVar]
scopedSort = go [] []
diff --git a/compiler/GHC/Core/TyCo/Ppr.hs b/compiler/GHC/Core/TyCo/Ppr.hs
index bc4e9b48e5..751aa11b75 100644
--- a/compiler/GHC/Core/TyCo/Ppr.hs
+++ b/compiler/GHC/Core/TyCo/Ppr.hs
@@ -314,7 +314,7 @@ pprTypeApp tc tys
------------------
-- | Display all kind information (with @-fprint-explicit-kinds@) when the
-- provided 'Bool' argument is 'True'.
--- See @Note [Kind arguments in error messages]@ in TcErrors.
+-- See @Note [Kind arguments in error messages]@ in GHC.Tc.Errors.
pprWithExplicitKindsWhen :: Bool -> SDoc -> SDoc
pprWithExplicitKindsWhen b
= updSDocContext $ \ctx ->
diff --git a/compiler/GHC/Core/TyCo/Rep.hs b/compiler/GHC/Core/TyCo/Rep.hs
index 1f96dd563b..8fe8f6e97d 100644
--- a/compiler/GHC/Core/TyCo/Rep.hs
+++ b/compiler/GHC/Core/TyCo/Rep.hs
@@ -121,7 +121,7 @@ The Class and its associated TyCon have the same Name.
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a 'TcTyThing', which is also a typecheckable
--- thing but in the *local* context. See 'TcEnv' for how to retrieve
+-- thing but in the *local* context. See 'GHC.Tc.Utils.Env' for how to retrieve
-- a 'TyThing' given a 'Name'.
data TyThing
= AnId Id
@@ -356,7 +356,7 @@ promote MkT as well.
How does this work?
-* In TcValidity.checkConstraintsOK we reject kinds that
+* In GHC.Tc.Validity.checkConstraintsOK we reject kinds that
have constraints other than (a~b) and (a~~b).
* In Inst.tcInstInvisibleTyBinder we instantiate a call
@@ -380,7 +380,7 @@ How does this work?
in TysPrim for a primer on these equality types.)
* How do we prevent a MkT having an illegal constraint like
- Eq a? We check for this at use-sites; see TcHsType.tcTyVar,
+ Eq a? We check for this at use-sites; see GHC.Tc.Gen.HsType.tcTyVar,
specifically dc_theta_illegal_constraint.
* Notice that nothing special happens if
@@ -663,7 +663,7 @@ are truly unrelated.
-- | A type labeled 'KnotTied' might have knot-tied tycons in it. See
-- Note [Type checking recursive type and class declarations] in
--- TcTyClsDecls
+-- GHC.Tc.TyCl
type KnotTied ty = ty
{- **********************************************************************
@@ -856,7 +856,7 @@ Here Foo's TyConBinders are
and its kind prints as
Foo :: forall a -> forall b. (a -> b -> Type) -> Type
-See also Note [Required, Specified, and Inferred for types] in TcTyClsDecls
+See also Note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
---- Printing -----
@@ -892,7 +892,7 @@ We could change this decision, but Required, Named TyCoBinders are rare
anyway. (Most are Anons.)
However the type of a term can (just about) have a required quantifier;
-see Note [Required quantifiers in the type of a term] in TcExpr.
+see Note [Required quantifiers in the type of a term] in GHC.Tc.Gen.Expr.
-}
@@ -1603,7 +1603,7 @@ equality types story] in TysPrim for background on equality constraints.
For unboxed equalities:
- Generate a CoercionHole, a mutable variable just like a unification
variable
- - Wrap the CoercionHole in a Wanted constraint; see TcRnTypes.TcEvDest
+ - Wrap the CoercionHole in a Wanted constraint; see GHC.Tc.Utils.TcEvDest
- Use the CoercionHole in a Coercion, via HoleCo
- Solve the constraint later
- When solved, fill in the CoercionHole by side effect, instead of
@@ -1650,7 +1650,7 @@ Note [CoercionHoles and coercion free variables]
Why does a CoercionHole contain a CoVar, as well as reference to
fill in? Because we want to treat that CoVar as a free variable of
the coercion. See #14584, and Note [What prevents a
-constraint from floating] in TcSimplify, item (4):
+constraint from floating] in GHC.Tc.Solver, item (4):
forall k. [W] co1 :: t1 ~# t2 |> co2
[W] co2 :: k ~# *
diff --git a/compiler/GHC/Core/TyCon.hs b/compiler/GHC/Core/TyCon.hs
index e3044095bc..64782e02b4 100644
--- a/compiler/GHC/Core/TyCon.hs
+++ b/compiler/GHC/Core/TyCon.hs
@@ -311,7 +311,7 @@ See also Note [Wrappers for data instance tycons] in GHC.Types.Id.Make
data type with some axioms that connect it to other data types.
* The tyConTyVars of the representation tycon are the tyvars that the
- user wrote in the patterns. This is important in TcDeriv, where we
+ user wrote in the patterns. This is important in GHC.Tc.Deriv, where we
bring these tyvars into scope before type-checking the deriving
clause. This fact is arranged for in TcInstDecls.tcDataFamInstDecl.
@@ -355,7 +355,7 @@ might happen, say, with the following declaration:
data T a b c where
MkT :: b -> T Int b c
-Data and class tycons have their roles inferred (see inferRoles in TcTyDecls),
+Data and class tycons have their roles inferred (see inferRoles in GHC.Tc.TyCl.Utils),
as do vanilla synonym tycons. Family tycons have all parameters at role N,
though it is conceivable that we could relax this restriction. (->)'s and
tuples' parameters are at role R. Each primitive tycon declares its roles;
@@ -405,9 +405,9 @@ must be True.
See also:
* [Injectivity annotation] in GHC.Hs.Decls
- * [Renaming injectivity annotation] in GHC.Rename.Source
+ * [Renaming injectivity annotation] in GHC.Rename.Module
* [Verifying injectivity annotation] in GHC.Core.FamInstEnv
- * [Type inference for type families with injectivity] in TcInteract
+ * [Type inference for type families with injectivity] in GHC.Tc.Solver.Interact
************************************************************************
* *
@@ -830,7 +830,7 @@ data TyCon
tyConKind :: Kind, -- ^ Kind of this TyCon
tyConArity :: Arity, -- ^ Arity
-- tyConTyVars connect an associated family TyCon
- -- with its parent class; see TcValidity.checkConsistentFamInst
+ -- with its parent class; see GHC.Tc.Validity.checkConsistentFamInst
famTcResVar :: Maybe Name, -- ^ Name of result type variable, used
-- for pretty-printing with --show-iface
@@ -897,7 +897,7 @@ data TyCon
}
-- | These exist only during type-checking. See Note [How TcTyCons work]
- -- in TcTyClsDecls
+ -- in GHC.Tc.TyCl
| TcTyCon {
tyConUnique :: Unique,
tyConName :: Name,
@@ -938,7 +938,7 @@ where
* required_tvs the same as tyConTyVars
* tyConArity = length required_tvs
-See also Note [How TcTyCons work] in TcTyClsDecls
+See also Note [How TcTyCons work] in GHC.Tc.TyCl
-}
-- | Represents right-hand-sides of 'TyCon's for algebraic types
@@ -1297,7 +1297,7 @@ so the coercion tycon CoT must have
kind: T ~ []
and arity: 0
-This eta-reduction is implemented in BuildTyCl.mkNewTyConRhs.
+This eta-reduction is implemented in GHC.Tc.TyCl.Build.mkNewTyConRhs.
************************************************************************
@@ -1331,7 +1331,7 @@ tyConRepName_maybe _ = Nothing
-- | Make a 'Name' for the 'Typeable' representation of the given wired-in type
mkPrelTyConRepName :: Name -> TyConRepName
--- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
+-- See Note [Grand plan for Typeable] in 'GHC.Tc.Instance.Typeable'.
mkPrelTyConRepName tc_name -- Prelude tc_name is always External,
-- so nameModule will work
= mkExternalName rep_uniq rep_mod rep_occ (nameSrcSpan tc_name)
@@ -1346,7 +1346,7 @@ mkPrelTyConRepName tc_name -- Prelude tc_name is always External,
-- | The name (and defining module) for the Typeable representation (TyCon) of a
-- type constructor.
--
--- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
+-- See Note [Grand plan for Typeable] in 'GHC.Tc.Instance.Typeable'.
tyConRepModOcc :: Module -> OccName -> (Module, OccName)
tyConRepModOcc tc_module tc_occ = (rep_module, mkTyConRepOcc tc_occ)
where
@@ -1702,12 +1702,12 @@ mkSumTyCon name binders res_kind arity tyvars cons parent
-- mutually-recursive group of tycons; it is then zonked to a proper
-- TyCon in zonkTcTyCon.
-- See also Note [Kind checking recursive type and class declarations]
--- in TcTyClsDecls.
+-- in GHC.Tc.TyCl.
mkTcTyCon :: Name
-> [TyConBinder]
-> Kind -- ^ /result/ kind only
-> [(Name,TcTyVar)] -- ^ Scoped type variables;
- -- see Note [How TcTyCons work] in TcTyClsDecls
+ -- see Note [How TcTyCons work] in GHC.Tc.TyCl
-> Bool -- ^ Is this TcTyCon generalised already?
-> TyConFlavour -- ^ What sort of 'TyCon' this represents
-> TyCon
@@ -1894,7 +1894,7 @@ isDataTyCon _ = False
-- (where X is the role passed in):
-- If (T a1 b1 c1) ~X (T a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2)
-- (where X1, X2, and X3, are the roles given by tyConRolesX tc X)
--- See also Note [Decomposing equality] in TcCanonical
+-- See also Note [Decomposing equality] in GHC.Tc.Solver.Canonical
isInjectiveTyCon :: TyCon -> Role -> Bool
isInjectiveTyCon _ Phantom = False
isInjectiveTyCon (FunTyCon {}) _ = True
@@ -1910,12 +1910,12 @@ isInjectiveTyCon (PrimTyCon {}) _ = True
isInjectiveTyCon (PromotedDataCon {}) _ = True
isInjectiveTyCon (TcTyCon {}) _ = True
-- Reply True for TcTyCon to minimise knock on type errors
- -- See Note [How TcTyCons work] item (1) in TcTyClsDecls
+ -- See Note [How TcTyCons work] item (1) in GHC.Tc.TyCl
-- | 'isGenerativeTyCon' is true of 'TyCon's for which this property holds
-- (where X is the role passed in):
-- If (T tys ~X t), then (t's head ~X T).
--- See also Note [Decomposing equality] in TcCanonical
+-- See also Note [Decomposing equality] in GHC.Tc.Solver.Canonical
isGenerativeTyCon :: TyCon -> Role -> Bool
isGenerativeTyCon (FamilyTyCon { famTcFlav = DataFamilyTyCon _ }) Nominal = True
isGenerativeTyCon (FamilyTyCon {}) _ = False
@@ -2249,7 +2249,7 @@ setTcTyConKind :: TyCon -> Kind -> TyCon
-- Update the Kind of a TcTyCon
-- The new kind is always a zonked version of its previous
-- kind, so we don't need to update any other fields.
--- See Note [The Purely Kinded Invariant] in TcHsType
+-- See Note [The Purely Kinded Invariant] in GHC.Tc.Gen.HsType
setTcTyConKind tc@(TcTyCon {}) kind = tc { tyConKind = kind }
setTcTyConKind tc _ = pprPanic "setTcTyConKind" (ppr tc)
@@ -2304,7 +2304,7 @@ expandSynTyCon_maybe tc tys
-- with user defined constructors rather than one from a class or other
-- construction.
--- NB: This is only used in TcRnExports.checkPatSynParent to determine if an
+-- NB: This is only used in GHC.Tc.Gen.Export.checkPatSynParent to determine if an
-- exported tycon can have a pattern synonym bundled with it, e.g.,
-- module Foo (TyCon(.., PatSyn)) where
isTyConWithSrcDataCons :: TyCon -> Bool
diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs
index 03e71ad915..7e7a72fe94 100644
--- a/compiler/GHC/Core/Type.hs
+++ b/compiler/GHC/Core/Type.hs
@@ -615,7 +615,7 @@ data TyCoMapper env m
-- a) To zonk TcTyCons
-- b) To turn TcTyCons into TyCons.
-- See Note [Type checking recursive type and class declarations]
- -- in TcTyClsDecls
+ -- in GHC.Tc.TyCl
}
{-# INLINE mapTyCo #-} -- See Note [Specialising mappers]
@@ -809,7 +809,7 @@ mkAppTy ty1 ty2 = AppTy ty1 ty2
-- Here Id is partially applied in the type sig for Foo,
-- but once the type synonyms are expanded all is well
--
- -- Moreover in TcHsTypes.tcInferApps we build up a type
+ -- Moreover in GHC.Tc.Types.tcInferApps we build up a type
-- (T t1 t2 t3) one argument at a type, thus forming
-- (T t1), (T t1 t2), etc
@@ -1325,7 +1325,7 @@ repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
-- have enough info to extract the runtime-rep arguments that
-- the funTyCon requires. This will usually be true;
-- but may be temporarily false during canonicalization:
--- see Note [FunTy and decomposing tycon applications] in TcCanonical
+-- see Note [FunTy and decomposing tycon applications] in GHC.Tc.Solver.Canonical
--
repSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys)
repSplitTyConApp_maybe (FunTy _ arg res)
@@ -1456,7 +1456,7 @@ we want
not ([a], a -> a)
The reason is that we then get better (shorter) type signatures in
-interfaces. Notably this plays a role in tcTySigs in TcBinds.hs.
+interfaces. Notably this plays a role in tcTySigs in GHC.Tc.Gen.Bind.
---------------------------------------------------------------------
@@ -2455,7 +2455,7 @@ occCheckExpand to expand any type synonyms in the kind of 'ty'
to eliminate 'a'. See kinding rule (FORALL) in
Note [Kinding rules for types]
-And in TcValidity.checkEscapingKind, we use also use
+And in GHC.Tc.Validity.checkEscapingKind, we use also use
occCheckExpand, for the same reason.
-}
@@ -3024,7 +3024,7 @@ Note [When does a tycon application need an explicit kind signature?]
There are a couple of places in GHC where we convert Core Types into forms that
more closely resemble user-written syntax. These include:
-1. Template Haskell Type reification (see, for instance, TcSplice.reify_tc_app)
+1. Template Haskell Type reification (see, for instance, GHC.Tc.Gen.Splice.reify_tc_app)
2. Converting Types to LHsTypes (in GHC.Hs.Utils.typeToLHsType, or in Haddock)
This conversion presents a challenge: how do we ensure that the resulting type
@@ -3064,7 +3064,7 @@ Suppose we have a tycon application (T ty_1 ... ty_n). Why might this type
require a kind signature? It might require it when we need to fill in any of
T's omitted arguments. By "omitted argument", we mean one that is dropped when
reifying ty_1 ... ty_n. Sometimes, the omitted arguments are inferred and
-specified arguments (e.g., TH reification in TcSplice), and sometimes the
+specified arguments (e.g., TH reification in GHC.Tc.Gen.Splice), and sometimes the
omitted arguments are only the inferred ones (e.g., in GHC.Hs.Utils.typeToLHsType,
which reifies specified arguments through visible kind application).
Regardless, the key idea is that _some_ arguments are going to be omitted after
diff --git a/compiler/GHC/Core/Unify.hs b/compiler/GHC/Core/Unify.hs
index 72b62ab9cd..2e77a9909e 100644
--- a/compiler/GHC/Core/Unify.hs
+++ b/compiler/GHC/Core/Unify.hs
@@ -410,7 +410,7 @@ tcUnifyTys :: (TyCoVar -> BindFlag)
-- for 'tcUnifyTysFG'
-- The two types may have common type variables, and indeed do so in the
--- second call to tcUnifyTys in FunDeps.checkClsFD
+-- second call to tcUnifyTys in GHC.Tc.Instance.FunDeps.checkClsFD
tcUnifyTys bind_fn tys1 tys2
= case tcUnifyTysFG bind_fn tys1 tys2 of
Unifiable result -> Just result
@@ -684,7 +684,7 @@ itself not purely syntactic; it accounts for CastTys;
see Note [Non-trivial definitional equality] in GHC.Core.TyCo.Rep
Unlike the "impure unifiers" in the typechecker (the eager unifier in
-TcUnify, and the constraint solver itself in TcCanonical), the pure
+GHC.Tc.Utils.Unify, and the constraint solver itself in GHC.Tc.Solver.Canonical), the pure
unifier It does /not/ work up to ~.
The algorithm implemented here is rather delicate, and we depend on it
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs
index 5cdf084a33..4902498042 100644
--- a/compiler/GHC/CoreToStg/Prep.hs
+++ b/compiler/GHC/CoreToStg/Prep.hs
@@ -35,7 +35,7 @@ import GHC.Core.Make hiding( FloatBind(..) ) -- We use our own FloatBind here
import GHC.Core.Type
import GHC.Types.Literal
import GHC.Core.Coercion
-import TcEnv
+import GHC.Tc.Utils.Env
import GHC.Core.TyCon
import GHC.Types.Demand
import GHC.Types.Var
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs
index a2e136be14..6ab71b7fec 100644
--- a/compiler/GHC/Driver/Backpack.hs
+++ b/compiler/GHC/Driver/Backpack.hs
@@ -30,8 +30,8 @@ import Parser
import Lexer
import GHC.Driver.Monad
import GHC.Driver.Session
-import TcRnMonad
-import TcRnDriver
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Module
import GHC.Types.Module
import GHC.Driver.Types
import StringBuffer
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs
index 3655f76564..1dd54d8d4a 100644
--- a/compiler/GHC/Driver/Flags.hs
+++ b/compiler/GHC/Driver/Flags.hs
@@ -284,7 +284,7 @@ data GeneralFlag
| Opt_ShowHoleConstraints
-- Options relating to the display of valid hole fits
-- when generating an error message for a typed hole
- -- See Note [Valid hole fits include] in TcHoleErrors.hs
+ -- See Note [Valid hole fits include] in GHC.Tc.Errors.Hole
| Opt_ShowValidHoleFits
| Opt_SortValidHoleFits
| Opt_SortBySizeHoleFits
diff --git a/compiler/GHC/Driver/Hooks.hs b/compiler/GHC/Driver/Hooks.hs
index 51ea03dac1..35b06ca1df 100644
--- a/compiler/GHC/Driver/Hooks.hs
+++ b/compiler/GHC/Driver/Hooks.hs
@@ -37,7 +37,7 @@ import GHC.Hs.Decls
import GHC.Hs.Binds
import GHC.Hs.Expr
import OrdList
-import TcRnTypes
+import GHC.Tc.Types
import Bag
import GHC.Types.Name.Reader
import GHC.Types.Name
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs
index a1246863b2..eb0996666f 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -111,10 +111,10 @@ import StringBuffer
import Parser
import Lexer
import GHC.Types.SrcLoc
-import TcRnDriver
+import GHC.Tc.Module
import GHC.IfaceToCore ( typecheckIface )
-import TcRnMonad
-import TcHsSyn ( ZonkFlexi (DefaultFlexi) )
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Zonk ( ZonkFlexi (DefaultFlexi) )
import GHC.Types.Name.Cache ( initNameCache )
import PrelInfo
import GHC.Core.Op.Simplify.Driver
@@ -143,7 +143,7 @@ import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
import Fingerprint ( Fingerprint )
import GHC.Driver.Hooks
-import TcEnv
+import GHC.Tc.Utils.Env
import PrelNames
import GHC.Driver.Plugins
import GHC.Runtime.Loader ( initializePlugins )
@@ -728,7 +728,7 @@ hscIncrementalCompile always_do_basic_recompilation_check m_tc_result
let hsc_env'' = hsc_env' { hsc_dflags = dflags }
-- One-shot mode needs a knot-tying mutable variable for interface
- -- files. See TcRnTypes.TcGblEnv.tcg_type_env_var.
+ -- files. See GHC.Tc.Utils.TcGblEnv.tcg_type_env_var.
-- See also Note [hsc_type_env_var hack]
type_env_var <- newIORef emptyNameEnv
let mod = ms_mod mod_summary
@@ -1762,7 +1762,7 @@ hscParsedDecls hsc_env decls = runInteractiveHsc hsc_env $ do
-- that might later be looked up by name. But we can exclude
-- - DFunIds, which are in 'cls_insts' (see Note [ic_tythings] in GHC.Driver.Types
-- - Implicit Ids, which are implicit in tcs
- -- c.f. TcRnDriver.runTcInteractive, which reconstructs the TypeEnv
+ -- c.f. GHC.Tc.Module.runTcInteractive, which reconstructs the TypeEnv
new_tythings = map AnId ext_ids ++ map ATyCon tcs ++ map (AConLike . PatSynCon) patsyns
ictxt = hsc_IC hsc_env
@@ -1788,7 +1788,7 @@ hscAddSptEntries hsc_env entries = do
To support fixity declarations on types defined within GHCi (as requested
in #10018) we record the fixity environment in InteractiveContext.
- When we want to evaluate something TcRnDriver.runTcInteractive pulls out this
+ When we want to evaluate something GHC.Tc.Module.runTcInteractive pulls out this
fixity environment and uses it to initialize the global typechecker environment.
After the typechecker has finished its business, an updated fixity environment
(reflecting whatever fixity declarations were present in the statements we
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index 051e9d56ce..359e602be8 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -47,7 +47,7 @@ import HeaderInfo
import GHC.Driver.Types
import GHC.Types.Module
import GHC.IfaceToCore ( typecheckIface )
-import TcRnMonad ( initIfaceCheck )
+import GHC.Tc.Utils.Monad ( initIfaceCheck )
import GHC.Driver.Main
import Bag ( unitBag, listToBag, unionManyBags, isEmptyBag )
@@ -64,7 +64,7 @@ import GHC.Types.SrcLoc
import StringBuffer
import GHC.Types.Unique.FM
import GHC.Types.Unique.DSet
-import TcBackpack
+import GHC.Tc.Utils.Backpack
import GHC.Driver.Packages
import GHC.Types.Unique.Set
import Util
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index a03eb6c9da..53d7b5f0ac 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -61,7 +61,7 @@ import GHC.Types.SrcLoc
import GHC.CmmToLlvm ( llvmFixupAsm, llvmVersionList )
import MonadUtils
import GHC.Platform
-import TcRnTypes
+import GHC.Tc.Types
import ToolSettings
import GHC.Driver.Hooks
import qualified GHC.LanguageExtensions as LangExt
diff --git a/compiler/GHC/Driver/Plugins.hs b/compiler/GHC/Driver/Plugins.hs
index bf2e9fe759..adc34373f0 100644
--- a/compiler/GHC/Driver/Plugins.hs
+++ b/compiler/GHC/Driver/Plugins.hs
@@ -50,9 +50,9 @@ module GHC.Driver.Plugins (
import GhcPrelude
import {-# SOURCE #-} GHC.Core.Op.Monad ( CoreToDo, CoreM )
-import qualified TcRnTypes
-import TcRnTypes ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports )
-import TcHoleFitTypes ( HoleFitPluginR )
+import qualified GHC.Tc.Types
+import GHC.Tc.Types ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports )
+import GHC.Tc.Errors.Hole.FitTypes ( HoleFitPluginR )
import GHC.Hs
import GHC.Driver.Session
import GHC.Driver.Types
@@ -188,7 +188,7 @@ instance Monoid PluginRecompile where
mempty = NoForceRecompile
type CorePlugin = [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
-type TcPlugin = [CommandLineOption] -> Maybe TcRnTypes.TcPlugin
+type TcPlugin = [CommandLineOption] -> Maybe GHC.Tc.Types.TcPlugin
type HoleFitPlugin = [CommandLineOption] -> Maybe HoleFitPluginR
purePlugin, impurePlugin, flagRecompile :: [CommandLineOption] -> IO PluginRecompile
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 461a3d17fe..f1efeea197 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -3630,7 +3630,7 @@ fFlagsDeps = [
-- | These @-f\<blah\>@ flags have to do with the typed-hole error message or
-- the valid hole fits in that message. See Note [Valid hole fits include ...]
--- in the TcHoleErrors module. These flags can all be reversed with
+-- in the GHC.Tc.Errors.Hole module. These flags can all be reversed with
-- @-fno-\<blah\>@
fHoleFlags :: [(Deprecation, FlagSpec GeneralFlag)]
fHoleFlags = [
@@ -3925,7 +3925,7 @@ defaultFlags settings
-- | These are the default settings for the display and sorting of valid hole
-- fits in typed-hole error messages. See Note [Valid hole fits include ...]
- -- in the TcHoleErrors module.
+ -- in the GHC.Tc.Errors.Hole module.
validHoleFitDefaults :: [GeneralFlag]
validHoleFitDefaults
= [ Opt_ShowTypeAppOfHoleFits
diff --git a/compiler/GHC/Driver/Types.hs b/compiler/GHC/Driver/Types.hs
index e19a854d1c..930350608c 100644
--- a/compiler/GHC/Driver/Types.hs
+++ b/compiler/GHC/Driver/Types.hs
@@ -467,8 +467,8 @@ data HscEnv
hsc_type_env_var :: Maybe (Module, IORef TypeEnv)
-- ^ Used for one-shot compilation only, to initialise
- -- the 'IfGblEnv'. See 'TcRnTypes.tcg_type_env_var' for
- -- 'TcRnTypes.TcGblEnv'. See also Note [hsc_type_env_var hack]
+ -- the 'IfGblEnv'. See 'GHC.Tc.Utils.tcg_type_env_var' for
+ -- 'GHC.Tc.Utils.TcGblEnv'. See also Note [hsc_type_env_var hack]
, hsc_interp :: Maybe Interp
-- ^ target code interpreter (if any) to use for TH and GHCi.
@@ -1624,7 +1624,7 @@ Where do interactively-bound Ids come from?
These start with an Internal Name because a Stmt is a local
construct, so the renamer naturally builds an Internal name for
each of its binders. Then in tcRnStmt they are externalised via
- TcRnDriver.externaliseAndTidyId, so they get Names like Ghic4.foo.
+ GHC.Tc.Module.externaliseAndTidyId, so they get Names like Ghic4.foo.
- Ids bound by the debugger etc have Names constructed by
GHC.Iface.Env.newInteractiveBinder; at the call sites it is followed by
@@ -2515,7 +2515,7 @@ data Dependencies
}
deriving( Eq )
-- Equality used only for old/new comparison in GHC.Iface.Recomp.addFingerprints
- -- See 'TcRnTypes.ImportAvails' for details on dependencies.
+ -- See 'GHC.Tc.Utils.ImportAvails' for details on dependencies.
instance Binary Dependencies where
put_ bh deps = do put_ bh (dep_mods deps)
@@ -2681,7 +2681,7 @@ data ExternalPackageState
--
-- The 'ModuleName' part is not necessary, but it's useful for
-- debug prints, and it's convenient because this field comes
- -- direct from 'TcRnTypes.imp_dep_mods'
+ -- direct from 'GHC.Tc.Utils.imp_dep_mods'
eps_PIT :: !PackageIfaceTable,
-- ^ The 'ModIface's for modules in external packages
@@ -3256,7 +3256,7 @@ And looking up the values in the CompleteMatchMap associated with Boolean
would give you [CompleteMatch [F, T1] Boolean, CompleteMatch [F, T2] Boolean].
dsGetCompleteMatches in GHC.HsToCore.Quote accomplishes this lookup.
-Also see Note [Typechecking Complete Matches] in TcBinds for a more detailed
+Also see Note [Typechecking Complete Matches] in GHC.Tc.Gen.Bind for a more detailed
explanation for how GHC ensures that all the conlikes in a COMPLETE set are
consistent.
-}
diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs
index efd4b7cd95..1471227528 100644
--- a/compiler/GHC/Hs/Binds.hs
+++ b/compiler/GHC/Hs/Binds.hs
@@ -33,7 +33,7 @@ import {-# SOURCE #-} GHC.Hs.Pat ( LPat )
import GHC.Hs.Extension
import GHC.Hs.Types
import GHC.Core
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core.Type
import GHC.Types.Name.Set
import GHC.Types.Basic
@@ -198,7 +198,7 @@ data HsBindLR idL idR
-- and variables @f = \x -> e@
-- and strict variables @!x = x + 1@
--
- -- Reason 1: Special case for type inference: see 'TcBinds.tcMonoBinds'.
+ -- Reason 1: Special case for type inference: see 'GHC.Tc.Gen.Bind.tcMonoBinds'.
--
-- Reason 2: Instance decls can only have FunBinds, which is convenient.
-- If you change this, you'll need to change e.g. rnMethodBinds
@@ -291,7 +291,7 @@ data HsBindLR idL idR
abs_exports :: [ABExport idL],
-- | Evidence bindings
- -- Why a list? See TcInstDcls
+ -- Why a list? See GHC.Tc.TyCl.Instance
-- Note [Typechecking plan for instance declarations]
abs_ev_binds :: [TcEvBinds],
@@ -590,7 +590,7 @@ This ultimately desugars to something like this:
The abe_wrap field deals with impedance-matching between
(/\a b. case tup a b of { (f,g) -> f })
and the thing we really want, which may have fewer type
-variables. The action happens in TcBinds.mkExport.
+variables. The action happens in GHC.Tc.Gen.Bind.mkExport.
Note [Bind free vars]
~~~~~~~~~~~~~~~~~~~~~
@@ -598,14 +598,14 @@ The bind_fvs field of FunBind and PatBind records the free variables
of the definition. It is used for the following purposes
a) Dependency analysis prior to type checking
- (see TcBinds.tc_group)
+ (see GHC.Tc.Gen.Bind.tc_group)
b) Deciding whether we can do generalisation of the binding
- (see TcBinds.decideGeneralisationPlan)
+ (see GHC.Tc.Gen.Bind.decideGeneralisationPlan)
c) Deciding whether the binding can be used in static forms
- (see TcExpr.checkClosedInStaticForm for the HsStatic case and
- TcBinds.isClosedBndrGroup).
+ (see GHC.Tc.Gen.Expr.checkClosedInStaticForm for the HsStatic case and
+ GHC.Tc.Gen.Bind.isClosedBndrGroup).
Specifically,
diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs
index 07cdb82a91..8a5cc16fbe 100644
--- a/compiler/GHC/Hs/Decls.hs
+++ b/compiler/GHC/Hs/Decls.hs
@@ -201,7 +201,7 @@ An `HsGroup p` stores every top-level fixity declarations in one of two places:
The story for fixity signatures for class methods is made slightly complicated
by the fact that they can appear both inside and outside of the class itself,
and both forms of fixity signatures are considered top-level. This matters
-in `GHC.Rename.Source.rnSrcDecls`, which must create a fixity environment out
+in `GHC.Rename.Module.rnSrcDecls`, which must create a fixity environment out
of all top-level fixity signatures before doing anything else. Therefore,
`rnSrcDecls` must be aware of both (1) and (2) above. The
`hsGroupTopLevelFixitySigs` function is responsible for collecting this
@@ -492,7 +492,7 @@ Each instance declaration gives rise to one dictionary function binding.
The type checker makes up new source-code instance declarations
(e.g. from 'deriving' or generic default methods --- see
-TcInstDcls.tcInstDecls1). So we can't generate the names for
+GHC.Tc.TyCl.Instance.tcInstDecls1). So we can't generate the names for
dictionary functions in advance (we don't know how many we need).
On the other hand for interface-file instance declarations, the decl
@@ -962,7 +962,7 @@ Invariants
ones.
See Note [Dependency analysis of type, class, and instance decls]
-in GHC.Rename.Source for more info.
+in GHC.Rename.Module for more info.
-}
-- | Type or Class Group
@@ -1284,7 +1284,7 @@ type LHsDerivingClause pass = Located (HsDerivingClause pass)
-- 'ApiAnnotation.AnnAnyClass', 'Api.AnnNewtype',
-- 'ApiAnnotation.AnnOpen','ApiAnnotation.AnnClose'
data HsDerivingClause pass
- -- See Note [Deriving strategies] in TcDeriv
+ -- See Note [Deriving strategies] in GHC.Tc.Deriv
= HsDerivingClause
{ deriv_clause_ext :: XCHsDerivingClause pass
, deriv_clause_strategy :: Maybe (LDerivStrategy pass)
@@ -1478,7 +1478,7 @@ There's a wrinkle in ConDeclGADT
con_args = PrefixCon []
con_res_ty = a :*: (b -> (a :*: (b -> (a :+: b))))
- - In the renamer (GHC.Rename.Source.rnConDecl), we unravel it after
+ - In the renamer (GHC.Rename.Module.rnConDecl), we unravel it after
operator fixities are sorted. So we generate. So we end
up with
con_args = PrefixCon [ a :*: b, a :*: b ]
@@ -1963,7 +1963,7 @@ data DerivDecl pass = DerivDecl
--
-- Which signifies that the context should be inferred.
- -- See Note [Inferring the instance context] in TcDerivInfer.
+ -- See Note [Inferring the instance context] in GHC.Tc.Deriv.Infer.
, deriv_strategy :: Maybe (LDerivStrategy pass)
, deriv_overlap_mode :: Maybe (Located OverlapMode)
@@ -2004,7 +2004,7 @@ type LDerivStrategy pass = Located (DerivStrategy pass)
-- | Which technique the user explicitly requested when deriving an instance.
data DerivStrategy pass
- -- See Note [Deriving strategies] in TcDeriv
+ -- See Note [Deriving strategies] in GHC.Tc.Deriv
= StockStrategy -- ^ GHC's \"standard\" strategy, which is to implement a
-- custom instance for the data type. This only works
-- for certain types that GHC knows about (e.g., 'Eq',
diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs
index c34e7eb809..478ed58364 100644
--- a/compiler/GHC/Hs/Expr.hs
+++ b/compiler/GHC/Hs/Expr.hs
@@ -36,7 +36,7 @@ import GHC.Hs.Types
import GHC.Hs.Binds
-- others:
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core
import GHC.Types.Name
import GHC.Types.Name.Set
@@ -48,8 +48,8 @@ import Outputable
import FastString
import GHC.Core.Type
import TysWiredIn (mkTupleStr)
-import TcType (TcType)
-import {-# SOURCE #-} TcRnTypes (TcLclEnv)
+import GHC.Tc.Utils.TcType (TcType)
+import {-# SOURCE #-} GHC.Tc.Types (TcLclEnv)
-- libraries:
import Data.Data hiding (Fixity(..))
@@ -836,7 +836,7 @@ A tuple data constructor like () or (,,,) is parsed as an `HsVar`, not an
Note that the tuple section has *inferred* arguments, while the data
constructor has *specified* ones.
- (See Note [Required, Specified, and Inferred for types] in TcTyClsDecls
+ (See Note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
for background.)
Sadly, the grammar for this is actually ambiguous, and it's only thanks to the
@@ -2376,7 +2376,7 @@ data HsSplice id
(IdP id) -- A unique name to identify this splice point
(LHsExpr id) -- See Note [Pending Splices]
- | HsQuasiQuote -- See Note [Quasi-quote overview] in TcSplice
+ | HsQuasiQuote -- See Note [Quasi-quote overview] in GHC.Tc.Gen.Splice
(XQuasiQuote id)
(IdP id) -- Splice point
(IdP id) -- Quoter
@@ -2435,7 +2435,7 @@ instance Data ThModFinalizers where
dataTypeOf a = mkDataType "HsExpr.ThModFinalizers" [toConstr a]
-- See Note [Running typed splices in the zonker]
--- These are the arguments that are passed to `TcSplice.runTopSplice`
+-- These are the arguments that are passed to `GHC.Tc.Gen.Splice.runTopSplice`
data DelayedSplice =
DelayedSplice
TcLclEnv -- The local environment to run the splice in
diff --git a/compiler/GHC/Hs/Lit.hs b/compiler/GHC/Hs/Lit.hs
index a0e95c973d..629ff6e32b 100644
--- a/compiler/GHC/Hs/Lit.hs
+++ b/compiler/GHC/Hs/Lit.hs
@@ -57,7 +57,7 @@ data HsLit x
-- ^ Packed bytes
| HsInt (XHsInt x) IntegralLit
-- ^ Genuinely an Int; arises from
- -- @TcGenDeriv@, and from TRANSLATION
+ -- @GHC.Tc.Deriv.Generate@, and from TRANSLATION
| HsIntPrim (XHsIntPrim x) {- SourceText -} Integer
-- ^ literal @Int#@
| HsWordPrim (XHsWordPrim x) {- SourceText -} Integer
diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs
index a93ad5d06a..fe5bbe65b6 100644
--- a/compiler/GHC/Hs/Pat.hs
+++ b/compiler/GHC/Hs/Pat.hs
@@ -55,7 +55,7 @@ import GHC.Hs.Binds
import GHC.Hs.Lit
import GHC.Hs.Extension
import GHC.Hs.Types
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Types.Basic
-- others:
import GHC.Core.Ppr ( {- instance OutputableBndr TyVar -} )
@@ -243,7 +243,7 @@ data Pat p
| NPlusKPat (XNPlusKPat p) -- Type of overall pattern
(Located (IdP p)) -- n+k pattern
(Located (HsOverLit p)) -- It'll always be an HsIntegral
- (HsOverLit p) -- See Note [NPlusK patterns] in TcPat
+ (HsOverLit p) -- See Note [NPlusK patterns] in GHC.Tc.Gen.Pat
-- NB: This could be (PostTc ...), but that induced a
-- a new hs-boot file. Not worth it.
@@ -449,7 +449,7 @@ data HsRecField' id arg = HsRecField {
--
-- hsRecFieldLbl = Unambiguous "x" $sel:x:MkS :: AmbiguousFieldOcc Id
--
--- See also Note [Disambiguating record fields] in TcExpr.
+-- See also Note [Disambiguating record fields] in GHC.Tc.Gen.Expr.
hsRecFields :: HsRecFields p arg -> [XCFieldOcc p]
hsRecFields rbinds = map (unLoc . hsRecFieldSel . unLoc) (rec_flds rbinds)
@@ -556,7 +556,7 @@ pprPat (ConPatOut { pat_con = con
, pat_args = details })
= sdocOption sdocPrintTypecheckerElaboration $ \case
False -> pprUserCon (unLoc con) details
- True -> -- Tiresome; in TcBinds.tcRhs we print out a
+ True -> -- Tiresome; in GHC.Tc.Gen.Bind.tcRhs we print out a
-- typechecked Pat in an error message,
-- and we want to make sure it prints nicely
ppr con
diff --git a/compiler/GHC/Hs/Types.hs b/compiler/GHC/Hs/Types.hs
index 21f9f38abf..6b2bd2dea2 100644
--- a/compiler/GHC/Hs/Types.hs
+++ b/compiler/GHC/Hs/Types.hs
@@ -143,7 +143,7 @@ Then we use a LHsBndrSig on the binder, so that the
renamer can decorate it with the variables bound
by the pattern ('a' in the first example, 'k' in the second),
assuming that neither of them is in scope already
-See also Note [Kind and type-variable binders] in GHC.Rename.Types
+See also Note [Kind and type-variable binders] in GHC.Rename.HsType
Note [HsType binders]
~~~~~~~~~~~~~~~~~~~~~
@@ -231,7 +231,7 @@ Note carefully:
determine whether or not to emit hole constraints on each wildcard
(we don't if it's a visible type/kind argument or a type family pattern).
See related notes Note [Wildcards in visible kind application]
- and Note [Wildcards in visible type application] in TcHsType.hs
+ and Note [Wildcards in visible type application] in GHC.Tc.Gen.HsType
* After type checking is done, we report what types the wildcards
got unified with.
@@ -264,7 +264,7 @@ By "stable", we mean that any two variables who do not depend on each other
preserve their existing left-to-right ordering.
Implicitly bound variables are collected by the extract- family of functions
-(extractHsTysRdrTyVars, extractHsTyVarBndrsKVs, etc.) in GHC.Rename.Types.
+(extractHsTysRdrTyVars, extractHsTyVarBndrsKVs, etc.) in GHC.Rename.HsType.
These functions thus promise to keep left-to-right ordering.
Look for pointers to this note to see the places where the action happens.
@@ -366,7 +366,7 @@ data HsImplicitBndrs pass thing -- See Note [HsType binders]
-- Implicitly-bound kind & type vars
-- Order is important; see
-- Note [Ordering of implicit variables]
- -- in GHC.Rename.Types
+ -- in GHC.Rename.HsType
, hsib_body :: thing -- Main payload (type or list of types)
}
@@ -601,7 +601,7 @@ data HsType pass
| HsParTy (XParTy pass)
(LHsType pass) -- See Note [Parens in HsSyn] in GHC.Hs.Expr
-- Parenthesis preserved for the precedence re-arrangement in
- -- GHC.Rename.Types
+ -- GHC.Rename.HsType
-- It's important that a * (b + c) doesn't get rearranged to (a*b) + c!
-- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen' @'('@,
-- 'ApiAnnotation.AnnClose' @')'@
@@ -1013,7 +1013,7 @@ terms, such as this example:
If we do not pattern-match on ForallInvis in hsScopedTvs, then `a` would
erroneously be brought into scope over the body of `x` when renaming it.
-Although the typechecker would later reject this (see `TcValidity.vdqAllowed`),
+Although the typechecker would later reject this (see `GHC.Tc.Validity.vdqAllowed`),
it is still possible for this to wreak havoc in the renamer before it gets to
that point (see #17687 for an example of this).
Bottom line: nip problems in the bud by matching on ForallInvis from the start.
@@ -1345,7 +1345,7 @@ mkFieldOcc rdr = FieldOcc noExtField rdr
-- occurrences).
--
-- See Note [HsRecField and HsRecUpdField] in GHC.Hs.Pat and
--- Note [Disambiguating record fields] in TcExpr.
+-- Note [Disambiguating record fields] in GHC.Tc.Gen.Expr.
-- See Note [Located RdrNames] in GHC.Hs.Expr
data AmbiguousFieldOcc pass
= Unambiguous (XUnambiguous pass) (Located RdrName)
diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs
index 99763d25a3..7c59c8abdb 100644
--- a/compiler/GHC/Hs/Utils.hs
+++ b/compiler/GHC/Hs/Utils.hs
@@ -10,8 +10,8 @@ which deal with the instantiated versions are located elsewhere:
Parameterised by Module
---------------- -------------
GhcPs/RdrName parser/RdrHsSyn
- GhcRn/Name rename/RnHsSyn
- GhcTc/Id typecheck/TcHsSyn
+ GhcRn/Name GHC.Rename.*
+ GhcTc/Id GHC.Tc.Utils.Zonk
The @mk*@ functions attempt to construct a not-completely-useless SrcSpan
from their components, compared with the @nl*@ functions which
@@ -109,13 +109,13 @@ import GHC.Hs.Types
import GHC.Hs.Lit
import GHC.Hs.Extension
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Types.Name.Reader
import GHC.Types.Var
import GHC.Core.TyCo.Rep
import GHC.Core.Type ( appTyArgFlags, splitAppTys, tyConArgFlags, tyConAppNeedsKindSig )
import TysWiredIn ( unitTy )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.DataCon
import GHC.Core.ConLike
import GHC.Types.Id
@@ -1023,7 +1023,7 @@ collect_bind _ (VarBind { var_id = f }) acc = f : acc
collect_bind _ (AbsBinds { abs_exports = dbinds }) acc = map abe_poly dbinds ++ acc
-- I don't think we want the binders from the abe_binds
- -- binding (hence see AbsBinds) is in zonking in TcHsSyn
+ -- binding (hence see AbsBinds) is in zonking in GHC.Tc.Utils.Zonk
collect_bind omitPatSyn (PatSynBind _ (PSB { psb_id = L _ ps })) acc
| omitPatSyn = acc
| otherwise = ps : acc
diff --git a/compiler/GHC/HsToCore.hs b/compiler/GHC/HsToCore.hs
index 16d64ff5ff..c89efc10b7 100644
--- a/compiler/GHC/HsToCore.hs
+++ b/compiler/GHC/HsToCore.hs
@@ -24,9 +24,9 @@ import GHC.HsToCore.Usage
import GHC.Driver.Session
import GHC.Driver.Types
import GHC.Hs
-import TcRnTypes
-import TcRnMonad ( finalSafeMode, fixSafeInstances )
-import TcRnDriver ( runTcInteractive )
+import GHC.Tc.Types
+import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances )
+import GHC.Tc.Module ( runTcInteractive )
import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Types.Name
diff --git a/compiler/GHC/HsToCore/Arrows.hs b/compiler/GHC/HsToCore/Arrows.hs
index da6d1aa062..479e804ecf 100644
--- a/compiler/GHC/HsToCore/Arrows.hs
+++ b/compiler/GHC/HsToCore/Arrows.hs
@@ -25,7 +25,7 @@ import GHC.HsToCore.Monad
import GHC.Hs hiding (collectPatBinders, collectPatsBinders,
collectLStmtsBinders, collectLStmtBinders,
collectStmtBinders )
-import TcHsSyn
+import GHC.Tc.Utils.Zonk
import qualified GHC.Hs.Utils as HsUtils
-- NB: The desugarer, which straddles the source and Core worlds, sometimes
@@ -36,9 +36,9 @@ import qualified GHC.Hs.Utils as HsUtils
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds,
dsSyntaxExpr )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type( splitPiTy )
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core
import GHC.Core.FVs
import GHC.Core.Utils
diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs
index dc20296cbd..e5e7838834 100644
--- a/compiler/GHC/HsToCore/Binds.hs
+++ b/compiler/GHC/HsToCore/Binds.hs
@@ -49,8 +49,8 @@ import GHC.Core.Predicate
import PrelNames
import GHC.Core.TyCon
-import TcEvidence
-import TcType
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.Coercion
import TysWiredIn ( typeNatKind, typeSymbolKind )
@@ -376,7 +376,7 @@ makeCorePair :: DynFlags -> Id -> Bool -> Arity -> CoreExpr
-> (Id, CoreExpr)
makeCorePair dflags gbl_id is_default_method dict_arity rhs
| is_default_method -- Default methods are *always* inlined
- -- See Note [INLINE and default methods] in TcInstDcls
+ -- See Note [INLINE and default methods] in GHC.Tc.TyCl.Instance
= (gbl_id `setIdUnfolding` mkCompulsoryUnfolding rhs, rhs)
| otherwise
@@ -647,7 +647,7 @@ dsSpecs :: CoreExpr -- Its rhs
-> TcSpecPrags
-> DsM ( OrdList (Id,CoreExpr) -- Binding for specialised Ids
, [CoreRule] ) -- Rules for the Global Ids
--- See Note [Handling SPECIALISE pragmas] in TcBinds
+-- See Note [Handling SPECIALISE pragmas] in GHC.Tc.Gen.Bind
dsSpecs _ IsDefaultMethod = return (nilOL, [])
dsSpecs poly_rhs (SpecPrags sps)
= do { pairs <- mapMaybeM (dsSpec (Just poly_rhs)) sps
@@ -960,9 +960,9 @@ Consider
{-# RULES "myrule" foo C = 1 #-}
After type checking the LHS becomes (foo alpha (C alpha)), where alpha
-is an unbound meta-tyvar. The zonker in TcHsSyn is careful not to
+is an unbound meta-tyvar. The zonker in GHC.Tc.Utils.Zonk is careful not to
turn the free alpha into Any (as it usually does). Instead it turns it
-into a TyVar 'a'. See TcHsSyn Note [Zonking the LHS of a RULE].
+into a TyVar 'a'. See Note [Zonking the LHS of a RULE] in Ghc.Tc.Syntax.
Now we must quantify over that 'a'. It's /really/ inconvenient to do that
in the zonker, because the HsExpr data type is very large. But it's /easy/
@@ -1124,7 +1124,7 @@ dsHsWrapper (WpLet ev_binds) = do { bs <- dsTcEvBinds ev_binds
dsHsWrapper (WpCompose c1 c2) = do { w1 <- dsHsWrapper c1
; w2 <- dsHsWrapper c2
; return (w1 . w2) }
- -- See comments on WpFun in TcEvidence for an explanation of what
+ -- See comments on WpFun in GHC.Tc.Types.Evidence for an explanation of what
-- the specification of this clause is
dsHsWrapper (WpFun c1 c2 t1 doc)
= do { x <- newSysLocalDsNoLP t1
@@ -1285,7 +1285,7 @@ ds_ev_typeable ty (EvTypeableTrFun ev1 ev2)
}
ds_ev_typeable ty (EvTypeableTyLit ev)
- = -- See Note [Typeable for Nat and Symbol] in TcInteract
+ = -- See Note [Typeable for Nat and Symbol] in GHC.Tc.Solver.Interact
do { fun <- dsLookupGlobalId tr_fun
; dict <- dsEvTerm ev -- Of type KnownNat/KnownSymbol
; let proxy = mkTyApps (Var proxyHashId) [ty_kind, ty]
diff --git a/compiler/GHC/HsToCore/Binds.hs-boot b/compiler/GHC/HsToCore/Binds.hs-boot
index aa3134ac72..fa5923ccc6 100644
--- a/compiler/GHC/HsToCore/Binds.hs-boot
+++ b/compiler/GHC/HsToCore/Binds.hs-boot
@@ -1,6 +1,6 @@
module GHC.HsToCore.Binds where
import GHC.HsToCore.Monad ( DsM )
import GHC.Core ( CoreExpr )
-import TcEvidence (HsWrapper)
+import GHC.Tc.Types.Evidence (HsWrapper)
dsHsWrapper :: HsWrapper -> DsM (CoreExpr -> CoreExpr)
diff --git a/compiler/GHC/HsToCore/Docs.hs b/compiler/GHC/HsToCore/Docs.hs
index 24dba94f7a..967e4c3185 100644
--- a/compiler/GHC/HsToCore/Docs.hs
+++ b/compiler/GHC/HsToCore/Docs.hs
@@ -19,7 +19,7 @@ import GHC.Hs.Utils
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.SrcLoc
-import TcRnTypes
+import GHC.Tc.Types
import Control.Applicative
import Data.Bifunctor (first)
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs
index 7f29491ceb..8b518cb988 100644
--- a/compiler/GHC/HsToCore/Expr.hs
+++ b/compiler/GHC/HsToCore/Expr.hs
@@ -41,9 +41,9 @@ import GHC.Hs
-- NB: The desugarer, which straddles the source and Core worlds, sometimes
-- needs to see source types
-import TcType
-import TcEvidence
-import TcRnMonad
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.Monad
import GHC.Core.Type
import GHC.Core
import GHC.Core.Utils
@@ -181,7 +181,7 @@ ds_val_bind (is_rec, binds) body
-- mixed up, which is what happens in one rare case
-- Namely, for an AbsBind with no tyvars and no dicts,
-- but which does have dictionary bindings.
- -- See notes with TcSimplify.inferLoop [NO TYVARS]
+ -- See notes with GHC.Tc.Solver.inferLoop [NO TYVARS]
-- It turned out that wrapping a Rec here was the easiest solution
--
-- NB The previous case dealt with unlifted bindings, so we
@@ -242,7 +242,7 @@ dsLExpr :: LHsExpr GhcTc -> DsM CoreExpr
dsLExpr (L loc e)
= putSrcSpanDs loc $
do { core_expr <- dsExpr e
- -- uncomment this check to test the hsExprType function in TcHsSyn
+ -- uncomment this check to test the hsExprType function in GHC.Tc.Utils.Zonk
-- ; MASSERT2( exprType core_expr `eqType` hsExprType e
-- , ppr e <+> dcolon <+> ppr (hsExprType e) $$
-- ppr core_expr <+> dcolon <+> ppr (exprType core_expr) )
@@ -649,7 +649,7 @@ dsExpr expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = fields
case con of
RealDataCon data_con -> dataConUserTyVars data_con
PatSynCon _ -> univ_tvs ++ ex_tvs
- -- The order here is because of the order in `TcPatSyn`.
+ -- The order here is because of the order in `GHC.Tc.TyCl.PatSyn`.
in_subst = zipTvSubst univ_tvs in_inst_tys
out_subst = zipTvSubst univ_tvs out_inst_tys
diff --git a/compiler/GHC/HsToCore/Foreign/Call.hs b/compiler/GHC/HsToCore/Foreign/Call.hs
index 5cbf22f92a..1ae9f3de65 100644
--- a/compiler/GHC/HsToCore/Foreign/Call.hs
+++ b/compiler/GHC/HsToCore/Foreign/Call.hs
@@ -35,7 +35,7 @@ import GHC.Types.ForeignCall
import GHC.Core.DataCon
import GHC.HsToCore.Utils
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Types.Id ( Id )
import GHC.Core.Coercion
diff --git a/compiler/GHC/HsToCore/Foreign/Decl.hs b/compiler/GHC/HsToCore/Foreign/Decl.hs
index 8b6d9a3974..49cfe5779a 100644
--- a/compiler/GHC/HsToCore/Foreign/Decl.hs
+++ b/compiler/GHC/HsToCore/Foreign/Decl.hs
@@ -18,7 +18,7 @@ module GHC.HsToCore.Foreign.Decl ( dsForeigns ) where
#include "HsVersions.h"
import GhcPrelude
-import TcRnMonad -- temp
+import GHC.Tc.Utils.Monad -- temp
import GHC.Core
@@ -36,8 +36,8 @@ import GHC.Core.Type
import GHC.Types.RepType
import GHC.Core.TyCon
import GHC.Core.Coercion
-import TcEnv
-import TcType
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcType
import GHC.Cmm.Expr
import GHC.Cmm.Utils
diff --git a/compiler/GHC/HsToCore/ListComp.hs b/compiler/GHC/HsToCore/ListComp.hs
index c67f1cbf64..8c27321824 100644
--- a/compiler/GHC/HsToCore/ListComp.hs
+++ b/compiler/GHC/HsToCore/ListComp.hs
@@ -19,7 +19,7 @@ import GhcPrelude
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsHandleMonadicFailure, dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds, dsSyntaxExpr )
import GHC.Hs
-import TcHsSyn
+import GHC.Tc.Utils.Zonk
import GHC.Core
import GHC.Core.Make
@@ -35,7 +35,7 @@ import GHC.HsToCore.Match
import PrelNames
import GHC.Types.SrcLoc
import Outputable
-import TcType
+import GHC.Tc.Utils.TcType
import ListSetOps( getNth )
import Util
diff --git a/compiler/GHC/HsToCore/Match.hs b/compiler/GHC/HsToCore/Match.hs
index dd29a08d3e..54d90ee284 100644
--- a/compiler/GHC/HsToCore/Match.hs
+++ b/compiler/GHC/HsToCore/Match.hs
@@ -31,9 +31,9 @@ import {-#SOURCE#-} GHC.HsToCore.Expr (dsLExpr, dsSyntaxExpr)
import GHC.Types.Basic ( Origin(..) )
import GHC.Driver.Session
import GHC.Hs
-import TcHsSyn
-import TcEvidence
-import TcRnMonad
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.Monad
import GHC.HsToCore.PmCheck
import GHC.Core
import GHC.Types.Literal
diff --git a/compiler/GHC/HsToCore/Match.hs-boot b/compiler/GHC/HsToCore/Match.hs-boot
index f1381707c8..a513a69f6d 100644
--- a/compiler/GHC/HsToCore/Match.hs-boot
+++ b/compiler/GHC/HsToCore/Match.hs-boot
@@ -2,7 +2,7 @@ module GHC.HsToCore.Match where
import GhcPrelude
import GHC.Types.Var ( Id )
-import TcType ( Type )
+import GHC.Tc.Utils.TcType ( Type )
import GHC.HsToCore.Monad ( DsM, EquationInfo, MatchResult )
import GHC.Core ( CoreExpr )
import GHC.Hs ( LPat, HsMatchContext, MatchGroup, LHsExpr )
diff --git a/compiler/GHC/HsToCore/Match/Constructor.hs b/compiler/GHC/HsToCore/Match/Constructor.hs
index f46780aee2..779d893eaf 100644
--- a/compiler/GHC/HsToCore/Match/Constructor.hs
+++ b/compiler/GHC/HsToCore/Match/Constructor.hs
@@ -24,7 +24,7 @@ import GHC.Hs
import GHC.HsToCore.Binds
import GHC.Core.ConLike
import GHC.Types.Basic ( Origin(..) )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.HsToCore.Monad
import GHC.HsToCore.Utils
import GHC.Core.Make ( mkCoreLets )
diff --git a/compiler/GHC/HsToCore/Match/Literal.hs b/compiler/GHC/HsToCore/Match/Literal.hs
index 4946c7b2ad..3afc455e99 100644
--- a/compiler/GHC/HsToCore/Match/Literal.hs
+++ b/compiler/GHC/HsToCore/Match/Literal.hs
@@ -39,8 +39,8 @@ import GHC.Core
import GHC.Core.Make
import GHC.Core.TyCon
import GHC.Core.DataCon
-import TcHsSyn ( shortCutLit )
-import TcType
+import GHC.Tc.Utils.Zonk ( shortCutLit )
+import GHC.Tc.Utils.TcType
import GHC.Types.Name
import GHC.Core.Type
import PrelNames
diff --git a/compiler/GHC/HsToCore/Monad.hs b/compiler/GHC/HsToCore/Monad.hs
index cd271b3abf..78c643e478 100644
--- a/compiler/GHC/HsToCore/Monad.hs
+++ b/compiler/GHC/HsToCore/Monad.hs
@@ -54,14 +54,14 @@ module GHC.HsToCore.Monad (
import GhcPrelude
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Core.FamInstEnv
import GHC.Core
import GHC.Core.Make ( unitExpr )
import GHC.Core.Utils ( exprType, isExprLevPoly )
import GHC.Hs
import GHC.IfaceToCore
-import TcMType ( checkForLevPolyX, formatLevPolyErr )
+import GHC.Tc.Utils.TcMType ( checkForLevPolyX, formatLevPolyErr )
import PrelNames
import GHC.Types.Name.Reader
import GHC.Driver.Types
@@ -449,7 +449,7 @@ failDs = failM
-- Regardless of success or failure,
-- propagate any errors/warnings generated by m
--
--- c.f. TcRnMonad.askNoErrs
+-- c.f. GHC.Tc.Utils.Monad.askNoErrs
askNoErrsDs :: DsM a -> DsM (a, Bool)
askNoErrsDs thing_inside
= do { errs_var <- newMutVar emptyMessages
@@ -478,7 +478,7 @@ instance MonadThings (IOEnv (Env DsGblEnv DsLclEnv)) where
lookupThing = dsLookupGlobal
dsLookupGlobal :: Name -> DsM TyThing
--- Very like TcEnv.tcLookupGlobal
+-- Very like GHC.Tc.Utils.Env.tcLookupGlobal
dsLookupGlobal name
= do { env <- getGblEnv
; setEnvs (ds_if_env env)
diff --git a/compiler/GHC/HsToCore/PmCheck.hs b/compiler/GHC/HsToCore/PmCheck.hs
index 389066a6f6..37fef0fc03 100644
--- a/compiler/GHC/HsToCore/PmCheck.hs
+++ b/compiler/GHC/HsToCore/PmCheck.hs
@@ -32,11 +32,11 @@ import GHC.Core (CoreExpr, Expr(Var,App))
import FastString (unpackFS, lengthFS)
import GHC.Driver.Session
import GHC.Hs
-import TcHsSyn ( shortCutLit )
+import GHC.Tc.Utils.Zonk (shortCutLit)
import GHC.Types.Id
import GHC.Core.ConLike
import GHC.Types.Name
-import FamInst
+import GHC.Tc.Instance.Family
import TysWiredIn
import GHC.Types.SrcLoc
import Util
@@ -45,8 +45,8 @@ import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Types.Var (EvVar)
import GHC.Core.Coercion
-import TcEvidence ( HsWrapper(..), isIdHsWrapper )
-import TcType (evVarPred)
+import GHC.Tc.Types.Evidence ( HsWrapper(..), isIdHsWrapper )
+import GHC.Tc.Utils.TcType (evVarPred)
import {-# SOURCE #-} GHC.HsToCore.Expr (dsExpr, dsLExpr, dsSyntaxExpr)
import {-# SOURCE #-} GHC.HsToCore.Binds (dsHsWrapper)
import GHC.HsToCore.Utils (selectMatchVar)
diff --git a/compiler/GHC/HsToCore/PmCheck/Oracle.hs b/compiler/GHC/HsToCore/PmCheck/Oracle.hs
index a4d849c910..e5c0e7ac92 100644
--- a/compiler/GHC/HsToCore/PmCheck/Oracle.hs
+++ b/compiler/GHC/HsToCore/PmCheck/Oracle.hs
@@ -60,13 +60,13 @@ import TysWiredIn
import TysPrim (tYPETyCon)
import GHC.Core.TyCo.Rep
import GHC.Core.Type
-import TcSimplify (tcNormalise, tcCheckSatisfiability)
-import GHC.Core.Unify (tcMatchTy)
-import TcRnTypes (completeMatchConLikes)
+import GHC.Tc.Solver (tcNormalise, tcCheckSatisfiability)
+import GHC.Core.Unify (tcMatchTy)
+import GHC.Tc.Types (completeMatchConLikes)
import GHC.Core.Coercion
import MonadUtils hiding (foldlM)
import GHC.HsToCore.Monad hiding (foldlM)
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import Control.Monad (guard, mzero, when)
diff --git a/compiler/GHC/HsToCore/PmCheck/Types.hs b/compiler/GHC/HsToCore/PmCheck/Types.hs
index 75652ac2b6..091e22f3ce 100644
--- a/compiler/GHC/HsToCore/PmCheck/Types.hs
+++ b/compiler/GHC/HsToCore/PmCheck/Types.hs
@@ -8,7 +8,7 @@ Author: George Karachalias <george.karachalias@cs.kuleuven.be>
{-# LANGUAGE TupleSections #-}
-- | Types used through-out pattern match checking. This module is mostly there
--- to be imported from "TcRnTypes". The exposed API is that of
+-- to be imported from "GHC.Tc.Types". The exposed API is that of
-- "GHC.HsToCore.PmCheck.Oracle" and "GHC.HsToCore.PmCheck".
module GHC.HsToCore.PmCheck.Types (
-- * Representations for Literals and AltCons
@@ -64,7 +64,7 @@ import GHC.Core.Utils (exprType)
import PrelNames
import TysWiredIn
import TysPrim
-import TcType (evVarPred)
+import GHC.Tc.Utils.TcType (evVarPred)
import Numeric (fromRat)
import Data.Foldable (find)
@@ -545,7 +545,7 @@ instance Outputable VarInfo where
initTmState :: TmState
initTmState = TmSt emptySDIE emptyCoreMap
--- | The type oracle state. A poor man's 'TcSMonad.InsertSet': The invariant is
+-- | The type oracle state. A poor man's 'GHC.Tc.Solver.Monad.InsertSet': The invariant is
-- that all constraints in there are mutually compatible.
newtype TyState = TySt (Bag EvVar)
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs
index 4de99748e5..d73b288d07 100644
--- a/compiler/GHC/HsToCore/Quote.hs
+++ b/compiler/GHC/HsToCore/Quote.hs
@@ -44,7 +44,7 @@ import GHC.Types.Id
import GHC.Types.Name hiding( varName, tcName )
import THNames
import GHC.Types.Name.Env
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.TyCon
import TysWiredIn
import GHC.Core
@@ -61,7 +61,7 @@ import GHC.Types.ForeignCall
import Util
import Maybes
import MonadUtils
-import TcEvidence
+import GHC.Tc.Types.Evidence
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Class
import GHC.Core.Class
@@ -192,7 +192,7 @@ instantiated.
> USE THE `wrapName` FUNCTION TO APPLY THE `m` TYPE VARIABLE TO A TYPE CONSTRUCTOR.
What the arguments should be instantiated to is supplied by the `QuoteWrapper`
-datatype which is produced by `TcSplice`. It is a pair of an evidence variable
+datatype which is produced by `GHC.Tc.Gen.Splice`. It is a pair of an evidence variable
for `Quote m` and a type variable `m`. All the polymorphic combinators in desugaring
need to be applied to these two type variables.
@@ -1383,7 +1383,7 @@ repRole (L _ Nothing) = rep2_nw inferRName []
-----------------------------------------------------------------------------
repSplice :: HsSplice GhcRn -> MetaM (Core a)
--- See Note [How brackets and nested splices are handled] in TcSplice
+-- See Note [How brackets and nested splices are handled] in GHC.Tc.Gen.Splice
-- We return a CoreExpr of any old type; the context should know
repSplice (HsTypedSplice _ _ n _) = rep_splice n
repSplice (HsUntypedSplice _ _ n _) = rep_splice n
diff --git a/compiler/GHC/HsToCore/Usage.hs b/compiler/GHC/HsToCore/Usage.hs
index 26e708dded..b0588a0a01 100644
--- a/compiler/GHC/HsToCore/Usage.hs
+++ b/compiler/GHC/HsToCore/Usage.hs
@@ -16,7 +16,7 @@ import GhcPrelude
import GHC.Driver.Session
import GHC.Driver.Ways
import GHC.Driver.Types
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.Module
diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs
index f7889e01ae..5e9dc25273 100644
--- a/compiler/GHC/HsToCore/Utils.hs
+++ b/compiler/GHC/HsToCore/Utils.hs
@@ -50,8 +50,8 @@ import {-# SOURCE #-} GHC.HsToCore.Match ( matchSimply )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsLExpr )
import GHC.Hs
-import TcHsSyn
-import TcType( tcSplitTyConApp )
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Utils.TcType( tcSplitTyConApp )
import GHC.Core
import GHC.HsToCore.Monad
@@ -81,7 +81,7 @@ import GHC.Driver.Session
import FastString
import qualified GHC.LanguageExtensions as LangExt
-import TcEvidence
+import GHC.Tc.Types.Evidence
import Control.Monad ( zipWithM )
import Data.List.NonEmpty (NonEmpty(..))
diff --git a/compiler/GHC/Iface/Binary.hs b/compiler/GHC/Iface/Binary.hs
index cc8472e040..1aa1fdafef 100644
--- a/compiler/GHC/Iface/Binary.hs
+++ b/compiler/GHC/Iface/Binary.hs
@@ -35,7 +35,7 @@ module GHC.Iface.Binary (
import GhcPrelude
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import PrelInfo ( isKnownKeyName, lookupKnownKeyName )
import GHC.Iface.Env
import GHC.Driver.Types
diff --git a/compiler/GHC/Iface/Env.hs b/compiler/GHC/Iface/Env.hs
index 8b12f50345..72cff8b8d7 100644
--- a/compiler/GHC/Iface/Env.hs
+++ b/compiler/GHC/Iface/Env.hs
@@ -24,7 +24,7 @@ module GHC.Iface.Env (
import GhcPrelude
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Driver.Types
import GHC.Core.Type
import GHC.Types.Var
diff --git a/compiler/GHC/Iface/Env.hs-boot b/compiler/GHC/Iface/Env.hs-boot
index 34d9a29960..72d0c26ba7 100644
--- a/compiler/GHC/Iface/Env.hs-boot
+++ b/compiler/GHC/Iface/Env.hs-boot
@@ -2,7 +2,7 @@ module GHC.Iface.Env where
import GHC.Types.Module
import GHC.Types.Name.Occurrence
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Name
import GHC.Types.SrcLoc
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs
index 7d45d8d798..a2e67f1170 100644
--- a/compiler/GHC/Iface/Ext/Ast.hs
+++ b/compiler/GHC/Iface/Ext/Ast.hs
@@ -34,11 +34,11 @@ import MonadUtils ( concatMapM, liftIO )
import GHC.Types.Name ( Name, nameSrcSpan, setNameLoc )
import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
import GHC.Types.SrcLoc
-import TcHsSyn ( hsLitType, hsPatType )
+import GHC.Tc.Utils.Zonk ( hsLitType, hsPatType )
import GHC.Core.Type ( mkVisFunTys, Type )
import TysWiredIn ( mkListTy, mkSumTy )
import GHC.Types.Var ( Id, Var, setVarName, varName, varType )
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Iface.Make ( mkIfaceExports )
import Panic
import Maybes
diff --git a/compiler/GHC/Iface/Load.hs b/compiler/GHC/Iface/Load.hs
index 9bc073b6a9..cf881e8f11 100644
--- a/compiler/GHC/Iface/Load.hs
+++ b/compiler/GHC/Iface/Load.hs
@@ -46,7 +46,7 @@ import GHC.Iface.Env
import GHC.Driver.Types
import GHC.Types.Basic hiding (SuccessFlag(..))
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import Constants
import PrelNames
@@ -204,7 +204,7 @@ All of this is done by the type checker. The renamer plays no role.
checkWiredInTyCon :: TyCon -> TcM ()
-- Ensure that the home module of the TyCon (and hence its instances)
-- are loaded. See Note [Loading instances for wired-in things]
--- It might not be a wired-in tycon (see the calls in TcUnify),
+-- It might not be a wired-in tycon (see the calls in GHC.Tc.Utils.Unify),
-- in which case this is a no-op.
checkWiredInTyCon tc
| not (isWiredInName tc_name)
@@ -542,7 +542,7 @@ But there is a HORRIBLE HACK here.
* At the end of tcRnImports, we call checkFamInstConsistency to
check consistency of imported type-family instances
- See Note [The type family instance consistency story] in FamInst
+ See Note [The type family instance consistency story] in GHC.Tc.Instance.Family
* Alas, those instances may refer to data types defined in M,
if there is a M.hs-boot.
diff --git a/compiler/GHC/Iface/Load.hs-boot b/compiler/GHC/Iface/Load.hs-boot
index 7718eb99f3..51270ccb33 100644
--- a/compiler/GHC/Iface/Load.hs-boot
+++ b/compiler/GHC/Iface/Load.hs-boot
@@ -1,7 +1,7 @@
module GHC.Iface.Load where
import GHC.Types.Module (Module)
-import TcRnMonad (IfM)
+import GHC.Tc.Utils.Monad (IfM)
import GHC.Driver.Types (ModIface)
import Outputable (SDoc)
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs
index 5cf6aa5f27..677c8cef71 100644
--- a/compiler/GHC/Iface/Make.hs
+++ b/compiler/GHC/Iface/Make.hs
@@ -38,10 +38,10 @@ import GHC.Core.Coercion.Axiom
import GHC.Core.ConLike
import GHC.Core.DataCon
import GHC.Core.Type
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Hs
import GHC.Driver.Types
import GHC.Driver.Session
@@ -218,7 +218,7 @@ mkIface_ hsc_env
not (isWiredInName name),
-- Nor wired-in things; the compiler knows about them anyhow
nameIsLocalOrFrom semantic_mod name ]
- -- Sigh: see Note [Root-main Id] in TcRnDriver
+ -- Sigh: see Note [Root-main Id] in GHC.Tc.Module
-- NB: ABSOLUTELY need to check against semantic_mod,
-- because all of the names in an hsig p[H=<H>]:H
-- are going to be for <H>, not the former id!
@@ -528,7 +528,7 @@ tyConToIfaceDecl env tycon
ifaceConDecls AbstractTyCon = IfAbstractTyCon
-- The AbstractTyCon case happens when a TyCon has been trimmed
-- during tidying.
- -- Furthermore, tyThingToIfaceDecl is also used in TcRnDriver
+ -- Furthermore, tyThingToIfaceDecl is also used in GHC.Tc.Module
-- for GHCi, when browsing a module, in which case the
-- AbstractTyCon and TupleTyCon cases are perfectly sensible.
-- (Tuple declarations are not serialised into interface files.)
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs
index 12830ab20e..4ecf9666ee 100644
--- a/compiler/GHC/Iface/Recomp.hs
+++ b/compiler/GHC/Iface/Recomp.hs
@@ -21,7 +21,7 @@ import FlagChecker
import GHC.Types.Annotations
import GHC.Core
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Hs
import GHC.Driver.Types
import GHC.Driver.Finder
diff --git a/compiler/GHC/Iface/Rename.hs b/compiler/GHC/Iface/Rename.hs
index 5d084155db..6bceb1effb 100644
--- a/compiler/GHC/Iface/Rename.hs
+++ b/compiler/GHC/Iface/Rename.hs
@@ -31,7 +31,7 @@ import GHC.Types.Var
import ErrUtils
import GHC.Types.Name
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import Util
import Fingerprint
import GHC.Types.Basic
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index 1f82ccfc7f..e33a938e26 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -777,7 +777,7 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
then isIfaceTauType kind
-- Even in the presence of a standalone kind signature, a non-tau
-- result kind annotation cannot be discarded as it determines the arity.
- -- See Note [Arity inference in kcCheckDeclHeader_sig] in TcHsType
+ -- See Note [Arity inference in kcCheckDeclHeader_sig] in GHC.Tc.Gen.HsType
else isIfaceLiftedTypeKind kind)
(dcolon <+> ppr kind)
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs
index 4bd11d227d..902cf23ac0 100644
--- a/compiler/GHC/Iface/Tidy.hs
+++ b/compiler/GHC/Iface/Tidy.hs
@@ -16,7 +16,7 @@ module GHC.Iface.Tidy (
import GhcPrelude
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Driver.Session
import GHC.Core
import GHC.Core.Unfold
@@ -47,8 +47,8 @@ import GHC.Types.Name.Set
import GHC.Types.Name.Cache
import GHC.Types.Avail
import GHC.Iface.Env
-import TcEnv
-import TcRnMonad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Monad
import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Core.Class
diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs
index 559587664e..346ba1efa8 100644
--- a/compiler/GHC/IfaceToCore.hs
+++ b/compiler/GHC/IfaceToCore.hs
@@ -30,9 +30,9 @@ import TcTypeNats(typeNatCoAxiomRules)
import GHC.Iface.Syntax
import GHC.Iface.Load
import GHC.Iface.Env
-import BuildTyCl
-import TcRnMonad
-import TcType
+import GHC.Tc.TyCl.Build
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.Coercion
import GHC.Core.Coercion.Axiom
diff --git a/compiler/GHC/IfaceToCore.hs-boot b/compiler/GHC/IfaceToCore.hs-boot
index b1e08e2e01..e658493d8f 100644
--- a/compiler/GHC/IfaceToCore.hs-boot
+++ b/compiler/GHC/IfaceToCore.hs-boot
@@ -4,7 +4,7 @@ import GhcPrelude
import GHC.Iface.Syntax ( IfaceDecl, IfaceClsInst, IfaceFamInst, IfaceRule
, IfaceAnnotation, IfaceCompleteMatch )
import GHC.Core.TyCo.Rep ( TyThing )
-import TcRnTypes ( IfL )
+import GHC.Tc.Types ( IfL )
import GHC.Core.InstEnv ( ClsInst )
import GHC.Core.FamInstEnv ( FamInst )
import GHC.Core ( CoreRule )
diff --git a/compiler/GHC/Plugins.hs b/compiler/GHC/Plugins.hs
index 2e342100bf..448b184f39 100644
--- a/compiler/GHC/Plugins.hs
+++ b/compiler/GHC/Plugins.hs
@@ -119,12 +119,12 @@ import GHC.Iface.Env ( lookupOrigIO )
import GhcPrelude
import MonadUtils ( mapMaybeM )
import GHC.ThToHs ( thRdrNameGuesses )
-import TcEnv ( lookupGlobal )
+import GHC.Tc.Utils.Env ( lookupGlobal )
import qualified Language.Haskell.TH as TH
{- This instance is defined outside GHC.Core.Op.Monad.hs so that
- GHC.Core.Op.Monad does not depend on TcEnv -}
+ GHC.Core.Op.Monad does not depend on GHC.Tc.Utils.Env -}
instance MonadThings CoreM where
lookupThing name = do { hsc_env <- getHscEnv
; liftIO $ lookupGlobal hsc_env name }
diff --git a/compiler/GHC/Rename/Binds.hs b/compiler/GHC/Rename/Bind.hs
index d0e4392fb8..f1e10fc323 100644
--- a/compiler/GHC/Rename/Binds.hs
+++ b/compiler/GHC/Rename/Bind.hs
@@ -15,7 +15,7 @@ type-synonym declarations; those cannot be done at this stage because
they may be affected by renaming (which isn't fully worked out yet).
-}
-module GHC.Rename.Binds (
+module GHC.Rename.Bind (
-- Renaming top-level bindings
rnTopBindsLHS, rnTopBindsBoot, rnValBindsRHS,
@@ -34,8 +34,8 @@ import GhcPrelude
import {-# SOURCE #-} GHC.Rename.Expr( rnLExpr, rnStmts )
import GHC.Hs
-import TcRnMonad
-import GHC.Rename.Types
+import GHC.Tc.Utils.Monad
+import GHC.Rename.HsType
import GHC.Rename.Pat
import GHC.Rename.Names
import GHC.Rename.Env
@@ -472,7 +472,7 @@ rnBind _ bind@(PatBind { pat_lhs = pat
fvs' = filterNameSet (nameIsLocalOrFrom mod) all_fvs
-- Keep locally-defined Names
-- As well as dependency analysis, we need these for the
- -- MonoLocalBinds test in TcBinds.decideGeneralisationPlan
+ -- MonoLocalBinds test in GHC.Tc.Gen.Bind.decideGeneralisationPlan
bndrs = collectPatBinders pat
bind' = bind { pat_rhs = grhss'
, pat_ext = fvs' }
@@ -511,7 +511,7 @@ rnBind sig_fn bind@(FunBind { fun_id = name
; let fvs' = filterNameSet (nameIsLocalOrFrom mod) rhs_fvs
-- Keep locally-defined Names
-- As well as dependency analysis, we need these for the
- -- MonoLocalBinds test in TcBinds.decideGeneralisationPlan
+ -- MonoLocalBinds test in GHC.Tc.Gen.Bind.decideGeneralisationPlan
; fvs' `seq` -- See Note [Free-variable space leak]
return (bind { fun_matches = matches'
@@ -720,7 +720,7 @@ rnPatSynBind sig_fn bind@(PSB { psb_id = L l name
fvs' = filterNameSet (nameIsLocalOrFrom mod) fvs
-- Keep locally-defined Names
-- As well as dependency analysis, we need these for the
- -- MonoLocalBinds test in TcBinds.decideGeneralisationPlan
+ -- MonoLocalBinds test in GHC.Tc.Gen.Bind.decideGeneralisationPlan
bind' = bind{ psb_args = details'
, psb_def = pat'
@@ -797,7 +797,7 @@ In this case, 'P' needs to be typechecked in two passes:
2. Typecheck the builder definition, which needs the typechecked
definition of 'f' to be in scope; done by calls oo tcPatSynBuilderBind
- in TcBinds.tcValBinds.
+ in GHC.Tc.Gen.Bind.tcValBinds.
This behaviour is implemented in 'tcValBinds', but it crucially
depends on 'P' not being put in a recursive group with 'f' (which
diff --git a/compiler/GHC/Rename/Doc.hs b/compiler/GHC/Rename/Doc.hs
index 2ccf2bfe8d..bd9fd60b73 100644
--- a/compiler/GHC/Rename/Doc.hs
+++ b/compiler/GHC/Rename/Doc.hs
@@ -4,7 +4,7 @@ module GHC.Rename.Doc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where
import GhcPrelude
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Hs
import GHC.Types.SrcLoc
diff --git a/compiler/GHC/Rename/Env.hs b/compiler/GHC/Rename/Env.hs
index 5e4a5a7ba0..1bd37047be 100644
--- a/compiler/GHC/Rename/Env.hs
+++ b/compiler/GHC/Rename/Env.hs
@@ -51,8 +51,8 @@ import GHC.Iface.Env
import GHC.Hs
import GHC.Types.Name.Reader
import GHC.Driver.Types
-import TcEnv
-import TcRnMonad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Monad
import RdrHsSyn ( filterCTuple, setRdrNameSpace )
import TysWiredIn
import GHC.Types.Name
@@ -400,7 +400,7 @@ lookupFamInstName :: Maybe Name -> Located RdrName
-> RnM (Located Name)
-- Used for TyData and TySynonym family instances only,
-- See Note [Family instance binders]
-lookupFamInstName (Just cls) tc_rdr -- Associated type; c.f GHC.Rename.Binds.rnMethodBind
+lookupFamInstName (Just cls) tc_rdr -- Associated type; c.f GHC.Rename.Bind.rnMethodBind
= wrapLocM (lookupInstDeclBndr cls (text "associated type")) tc_rdr
lookupFamInstName Nothing tc_rdr -- Family instance; tc_rdr is an *occurrence*
= lookupLocatedOccRn tc_rdr
@@ -912,7 +912,7 @@ lookupOccRn rdr_name
Nothing -> reportUnboundName rdr_name }
-- Only used in one place, to rename pattern synonym binders.
--- See Note [Renaming pattern synonym variables] in GHC.Rename.Binds
+-- See Note [Renaming pattern synonym variables] in GHC.Rename.Bind
lookupLocalOccRn :: RdrName -> RnM Name
lookupLocalOccRn rdr_name
= do { mb_name <- lookupLocalOccRn_maybe rdr_name
diff --git a/compiler/GHC/Rename/Expr.hs b/compiler/GHC/Rename/Expr.hs
index 7b865dc824..d091dc66fa 100644
--- a/compiler/GHC/Rename/Expr.hs
+++ b/compiler/GHC/Rename/Expr.hs
@@ -27,11 +27,11 @@ module GHC.Rename.Expr (
import GhcPrelude
-import GHC.Rename.Binds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS
+import GHC.Rename.Bind ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS
, rnMatchGroup, rnGRHS, makeMiniFixityEnv)
import GHC.Hs
-import TcEnv ( isBrackStage )
-import TcRnMonad
+import GHC.Tc.Utils.Env ( isBrackStage )
+import GHC.Tc.Utils.Monad
import GHC.Types.Module ( getModule )
import GHC.Rename.Env
import GHC.Rename.Fixity
@@ -42,7 +42,7 @@ import GHC.Rename.Utils ( HsDocContext(..), bindLocalNamesFV, checkDupNames
, checkUnusedRecordWildcard )
import GHC.Rename.Unbound ( reportUnboundName )
import GHC.Rename.Splice ( rnBracket, rnSpliceExpr, checkThLocalName )
-import GHC.Rename.Types
+import GHC.Rename.HsType
import GHC.Rename.Pat
import GHC.Driver.Session
import PrelNames
@@ -189,7 +189,7 @@ rnExpr (OpApp _ e1 op e2)
-- Deal with fixity
-- When renaming code synthesised from "deriving" declarations
-- we used to avoid fixity stuff, but we can't easily tell any
- -- more, so I've removed the test. Adding HsPars in TcGenDeriv
+ -- more, so I've removed the test. Adding HsPars in GHC.Tc.Deriv.Generate
-- should prevent bad things happening.
; fixity <- case op' of
L _ (HsVar _ (L _ n)) -> lookupFixityRn n
@@ -457,7 +457,7 @@ rnCmd (HsCmdArrApp x arrow arg ho rtl)
select_arrow_scope tc = case ho of
HsHigherOrderApp -> tc
HsFirstOrderApp -> escapeArrowScope tc
- -- See Note [Escaping the arrow scope] in TcRnTypes
+ -- See Note [Escaping the arrow scope] in GHC.Tc.Types
-- Before renaming 'arrow', use the environment of the enclosing
-- proc for the (-<) case.
-- Local bindings, inside the enclosing proc, are not in scope
@@ -1507,7 +1507,7 @@ ApplicativeDo touches a few phases in the compiler:
other form of expression. The only crux is that the typechecker has to
be aware of the special ApplicativeDo statements in the do-notation, and
typecheck them appropriately.
- Relevant module: TcMatches
+ Relevant module: GHC.Tc.Gen.Match
* Desugarer: Any do-block which contains applicative statements is desugared
as outlined above, to use the Applicative combinators.
diff --git a/compiler/GHC/Rename/Expr.hs-boot b/compiler/GHC/Rename/Expr.hs-boot
index a5292471d8..012b7731b3 100644
--- a/compiler/GHC/Rename/Expr.hs-boot
+++ b/compiler/GHC/Rename/Expr.hs-boot
@@ -2,7 +2,7 @@ module GHC.Rename.Expr where
import GHC.Types.Name
import GHC.Hs
import GHC.Types.Name.Set ( FreeVars )
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Types.SrcLoc ( Located )
import Outputable ( Outputable )
diff --git a/compiler/GHC/Rename/Fixity.hs b/compiler/GHC/Rename/Fixity.hs
index cf5ca883da..9400c0582f 100644
--- a/compiler/GHC/Rename/Fixity.hs
+++ b/compiler/GHC/Rename/Fixity.hs
@@ -22,7 +22,7 @@ import GHC.Iface.Load
import GHC.Hs
import GHC.Types.Name.Reader
import GHC.Driver.Types
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Module
diff --git a/compiler/GHC/Rename/Types.hs b/compiler/GHC/Rename/HsType.hs
index 23e9fe0879..f269653c62 100644
--- a/compiler/GHC/Rename/Types.hs
+++ b/compiler/GHC/Rename/HsType.hs
@@ -8,7 +8,7 @@
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeFamilies #-}
-module GHC.Rename.Types (
+module GHC.Rename.HsType (
-- Type related stuff
rnHsType, rnLHsType, rnLHsTypes, rnContext,
rnHsKind, rnLHsKind, rnLHsTypeArgs,
@@ -45,7 +45,7 @@ import GHC.Rename.Utils ( HsDocContext(..), withHsDocContext, mapFvRn
, newLocalBndrRn, checkDupRdrNames, checkShadowedRdrNames )
import GHC.Rename.Fixity ( lookupFieldFixityRn, lookupFixityRn
, lookupTyFixityRn )
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Name.Reader
import PrelNames
import TysPrim ( funTyConName )
@@ -70,7 +70,7 @@ import Control.Monad ( unless, when )
#include "HsVersions.h"
{-
-These type renamers are in a separate module, rather than in (say) GHC.Rename.Source,
+These type renamers are in a separate module, rather than in (say) GHC.Rename.Module,
to break several loop.
*********************************************************
@@ -1012,7 +1012,7 @@ argument, build a map and look them up.
rnConDeclFields :: HsDocContext -> [FieldLabel] -> [LConDeclField GhcPs]
-> RnM ([LConDeclField GhcRn], FreeVars)
--- Also called from GHC.Rename.Source
+-- Also called from GHC.Rename.Module
-- No wildcards can appear in record fields
rnConDeclFields ctxt fls fields
= mapFvRn (rnField fl_env env) fields
diff --git a/compiler/GHC/Rename/Source.hs b/compiler/GHC/Rename/Module.hs
index fabe5b817d..89bc307809 100644
--- a/compiler/GHC/Rename/Source.hs
+++ b/compiler/GHC/Rename/Module.hs
@@ -13,7 +13,7 @@ Main pass of renamer
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module GHC.Rename.Source (
+module GHC.Rename.Module (
rnSrcDecls, addTcgDUs, findSplice
) where
@@ -27,8 +27,8 @@ import {-# SOURCE #-} GHC.Rename.Splice ( rnSpliceDecl, rnTopSpliceDecls )
import GHC.Hs
import GHC.Types.FieldLabel
import GHC.Types.Name.Reader
-import GHC.Rename.Types
-import GHC.Rename.Binds
+import GHC.Rename.HsType
+import GHC.Rename.Bind
import GHC.Rename.Env
import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, bindLocalNames
, checkDupRdrNames, inHsDocContext, bindLocalNamesFV
@@ -38,8 +38,8 @@ import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, bindLocalNames
import GHC.Rename.Unbound ( mkUnboundName, notInScopeErr )
import GHC.Rename.Names
import GHC.Rename.Doc ( rnHsDoc, rnMbLHsDoc )
-import TcAnnotations ( annCtxt )
-import TcRnMonad
+import GHC.Tc.Gen.Annotation ( annCtxt )
+import GHC.Tc.Utils.Monad
import GHC.Types.ForeignCall ( CCallTarget(..) )
import GHC.Types.Module
@@ -594,7 +594,7 @@ checkCanonicalInstances cls poly_ty mbinds = do
quotes (text (lhs ++ " = " ++ rhs))
]
- -- stolen from TcInstDcls
+ -- stolen from GHC.Tc.TyCl.Instance
instDeclCtxt1 :: LHsSigType GhcRn -> SDoc
instDeclCtxt1 hs_inst_ty
= inst_decl_ctxt (ppr (getLHsInstDeclHead hs_inst_ty))
@@ -848,7 +848,7 @@ rnATInstDecls :: (AssocTyFamInfo -> -- The function that renames
-- and the family instance declarations in an instance
--
-- NB: We allow duplicate associated-type decls;
--- See Note [Associated type instances] in TcInstDcls
+-- See Note [Associated type instances] in GHC.Tc.TyCl.Instance
rnATInstDecls rnFun cls tv_ns at_insts
= rnList (rnFun (AssocTyFamInst cls tv_ns)) at_insts
-- See Note [Renaming associated types]
@@ -873,7 +873,7 @@ it is handled pretty much the same way as the ones in partial type signatures.
We however don't want to emit hole constraints on wildcards in family
instances, so we turn on PartialTypeSignatures and turn off warning flag to
let typechecker know this.
-See related Note [Wildcards in visible kind application] in TcHsType.hs
+See related Note [Wildcards in visible kind application] in GHC.Tc.Gen.HsType
Note [Unused type variables in family instances]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -957,7 +957,7 @@ Even though `a` is not bound by the forall, this is still accepted because `a`
was previously bound by the `instance C (Maybe a)` part. (see #16116).
In each case, the function which detects improperly bound variables on the RHS
-is TcValidity.checkValidFamPats.
+is GHC.Tc.Validity.checkValidFamPats.
-}
@@ -1184,7 +1184,7 @@ reasons:
is jolly confusing. See #4875
-* Increase kind polymorphism. See TcTyClsDecls
+* Increase kind polymorphism. See GHC.Tc.TyCl
Note [Grouping of type and class declarations]
Why do the instance declarations participate? At least two reasons
@@ -1282,7 +1282,7 @@ with different dependency structure!)
Ugh. For now we simply don't allow promotion of data constructors for
data instances. See Note [AFamDataCon: not promoting data family
-constructors] in TcEnv
+constructors] in GHC.Tc.Utils.Env
-}
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs
index 286de91a9e..5a5c7f1950 100644
--- a/compiler/GHC/Rename/Names.hs
+++ b/compiler/GHC/Rename/Names.hs
@@ -37,12 +37,12 @@ import GhcPrelude
import GHC.Driver.Session
import GHC.Core.TyCo.Ppr
import GHC.Hs
-import TcEnv
+import GHC.Tc.Utils.Env
import GHC.Rename.Env
import GHC.Rename.Fixity
import GHC.Rename.Utils ( warnUnusedTopBinds, mkFieldEnv )
import GHC.Iface.Load ( loadSrcInterface )
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import PrelNames
import GHC.Types.Module
import GHC.Types.Name
diff --git a/compiler/GHC/Rename/Pat.hs b/compiler/GHC/Rename/Pat.hs
index 7b83b8702d..c8a2cbb023 100644
--- a/compiler/GHC/Rename/Pat.hs
+++ b/compiler/GHC/Rename/Pat.hs
@@ -52,8 +52,8 @@ import {-# SOURCE #-} GHC.Rename.Splice ( rnSplicePat )
#include "HsVersions.h"
import GHC.Hs
-import TcRnMonad
-import TcHsSyn ( hsOverLitName )
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Zonk ( hsOverLitName )
import GHC.Rename.Env
import GHC.Rename.Fixity
import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn, bindLocalNames
@@ -61,7 +61,7 @@ import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn, bindLocalNames
, checkUnusedRecordWildcard
, checkDupNames, checkDupAndShadowedNames
, checkTupSize , unknownSubordinateErr )
-import GHC.Rename.Types
+import GHC.Rename.HsType
import PrelNames
import GHC.Types.Name
import GHC.Types.Name.Set
@@ -249,7 +249,7 @@ newPatName (LetMk is_top fix_env) rdr_name
-- however, this binding seems to work, and it only exists for
-- the duration of the patterns and the continuation;
-- then the top-level name is added to the global env
- -- before going on to the RHSes (see GHC.Rename.Source).
+ -- before going on to the RHSes (see GHC.Rename.Module).
{-
Note [View pattern usage]
@@ -732,7 +732,7 @@ rnHsRecUpdFields flds
= do { let lbl = rdrNameAmbiguousFieldOcc f
; sel <- setSrcSpan loc $
-- Defer renaming of overloaded fields to the typechecker
- -- See Note [Disambiguating record fields] in TcExpr
+ -- See Note [Disambiguating record fields] in GHC.Tc.Gen.Expr
if overload_ok
then do { mb <- lookupGlobalOccRn_overloaded
overload_ok lbl
diff --git a/compiler/GHC/Rename/Splice.hs b/compiler/GHC/Rename/Splice.hs
index 2275ca6ab8..5c7d287a38 100644
--- a/compiler/GHC/Rename/Splice.hs
+++ b/compiler/GHC/Rename/Splice.hs
@@ -20,36 +20,36 @@ import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Hs
import GHC.Types.Name.Reader
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Rename.Env
import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn )
import GHC.Rename.Unbound ( isUnboundName )
-import GHC.Rename.Source ( rnSrcDecls, findSplice )
+import GHC.Rename.Module ( rnSrcDecls, findSplice )
import GHC.Rename.Pat ( rnPat )
import GHC.Types.Basic ( TopLevelFlag, isTopLevel, SourceText(..) )
import Outputable
import GHC.Types.Module
import GHC.Types.SrcLoc
-import GHC.Rename.Types ( rnLHsType )
+import GHC.Rename.HsType ( rnLHsType )
import Control.Monad ( unless, when )
import {-# SOURCE #-} GHC.Rename.Expr ( rnLExpr )
-import TcEnv ( checkWellStaged )
+import GHC.Tc.Utils.Env ( checkWellStaged )
import THNames ( liftName )
import GHC.Driver.Session
import FastString
import ErrUtils ( dumpIfSet_dyn_printer, DumpFormat (..) )
-import TcEnv ( tcMetaTy )
+import GHC.Tc.Utils.Env ( tcMetaTy )
import GHC.Driver.Hooks
import THNames ( quoteExpName, quotePatName, quoteDecName, quoteTypeName
, decsQTyConName, expQTyConName, patQTyConName, typeQTyConName, )
-import {-# SOURCE #-} TcExpr ( tcPolyExpr )
-import {-# SOURCE #-} TcSplice
+import {-# SOURCE #-} GHC.Tc.Gen.Expr ( tcPolyExpr )
+import {-# SOURCE #-} GHC.Tc.Gen.Splice
( runMetaD
, runMetaE
, runMetaP
@@ -57,7 +57,7 @@ import {-# SOURCE #-} TcSplice
, tcTopSpliceExpr
)
-import TcHsSyn
+import GHC.Tc.Utils.Zonk
import GHCi.RemoteTypes ( ForeignRef )
import qualified Language.Haskell.TH as TH (Q)
@@ -91,7 +91,7 @@ rnBracket e br_body
; Splice Untyped -> checkTc (not (isTypedBracket br_body))
illegalTypedBracket
; RunSplice _ ->
- -- See Note [RunSplice ThLevel] in "TcRnTypes".
+ -- See Note [RunSplice ThLevel] in GHC.Tc.Types.
pprPanic "rnBracket: Renaming bracket when running a splice"
(ppr e)
; Comp -> return ()
@@ -540,10 +540,10 @@ References:
[1] https://gitlab.haskell.org/ghc/ghc/wikis/template-haskell/reify
[2] 'rnSpliceExpr'
-[3] 'TcSplice.qAddModFinalizer'
-[4] 'TcExpr.tcExpr' ('HsSpliceE' ('HsSpliced' ...))
-[5] 'TcHsType.tc_hs_type' ('HsSpliceTy' ('HsSpliced' ...))
-[6] 'TcPat.tc_pat' ('SplicePat' ('HsSpliced' ...))
+[3] 'GHC.Tc.Gen.Splice.qAddModFinalizer'
+[4] 'GHC.Tc.Gen.Expr.tcExpr' ('HsSpliceE' ('HsSpliced' ...))
+[5] 'GHC.Tc.Gen.HsType.tc_hs_type' ('HsSpliceTy' ('HsSpliced' ...))
+[6] 'GHC.Tc.Gen.Pat.tc_pat' ('SplicePat' ('HsSpliced' ...))
-}
@@ -600,7 +600,7 @@ are given names during renaming. These names are collected right after
renaming. The names generated for anonymous wild cards in TH type splices will
thus be collected as well.
-For more details about renaming wild cards, see GHC.Rename.Types.rnHsSigWcType
+For more details about renaming wild cards, see GHC.Rename.HsType.rnHsSigWcType
Note that partial type signatures are fully supported in TH declaration
splices, e.g.:
@@ -812,7 +812,7 @@ checkCrossStageLifting :: TopLevelFlag -> ThLevel -> ThStage -> ThLevel
-- Examples \x -> [| x |]
-- [| map |]
--
--- This code is similar to checkCrossStageLifting in TcExpr, but
+-- This code is similar to checkCrossStageLifting in GHC.Tc.Gen.Expr, but
-- this is only run on *untyped* brackets.
checkCrossStageLifting top_lvl bind_lvl use_stage use_lvl name
@@ -891,7 +891,7 @@ them in the keep-alive set.
Note [Quoting names]
~~~~~~~~~~~~~~~~~~~~
A quoted name 'n is a bit like a quoted expression [| n |], except that we
-have no cross-stage lifting (c.f. TcExpr.thBrackId). So, after incrementing
+have no cross-stage lifting (c.f. GHC.Tc.Gen.Expr.thBrackId). So, after incrementing
the use-level to account for the brackets, the cases are:
bind > use Error
diff --git a/compiler/GHC/Rename/Splice.hs-boot b/compiler/GHC/Rename/Splice.hs-boot
index f14be280fc..a885ea4387 100644
--- a/compiler/GHC/Rename/Splice.hs-boot
+++ b/compiler/GHC/Rename/Splice.hs-boot
@@ -2,7 +2,7 @@ module GHC.Rename.Splice where
import GhcPrelude
import GHC.Hs
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Name.Set
diff --git a/compiler/GHC/Rename/Unbound.hs b/compiler/GHC/Rename/Unbound.hs
index 957a82e81c..0de085eabf 100644
--- a/compiler/GHC/Rename/Unbound.hs
+++ b/compiler/GHC/Rename/Unbound.hs
@@ -21,7 +21,7 @@ import GhcPrelude
import GHC.Types.Name.Reader
import GHC.Driver.Types
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Name
import GHC.Types.Module
import GHC.Types.SrcLoc as SrcLoc
@@ -90,7 +90,7 @@ type HowInScope = Either SrcSpan ImpDeclSpec
-- Right ispec => imported as specified by ispec
--- | Called from the typechecker (TcErrors) when we find an unbound variable
+-- | Called from the typechecker (GHC.Tc.Errors) when we find an unbound variable
unknownNameSuggestions :: DynFlags
-> HomePackageTable -> Module
-> GlobalRdrEnv -> LocalRdrEnv -> ImportAvails
diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs
index 32ac27d12f..2ed7c5db95 100644
--- a/compiler/GHC/Rename/Utils.hs
+++ b/compiler/GHC/Rename/Utils.hs
@@ -38,8 +38,8 @@ import GhcPrelude
import GHC.Hs
import GHC.Types.Name.Reader
import GHC.Driver.Types
-import TcEnv
-import TcRnMonad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Monad
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.Name.Env
@@ -506,7 +506,7 @@ pprHsDocContext TypBrCtx = text "a Template-Haskell quoted type"
pprHsDocContext HsTypeCtx = text "a type argument"
pprHsDocContext GHCiCtx = text "GHCi input"
pprHsDocContext (SpliceTypeCtx hs_ty) = text "the spliced type" <+> quotes (ppr hs_ty)
-pprHsDocContext ClassInstanceCtx = text "TcSplice.reifyInstances"
+pprHsDocContext ClassInstanceCtx = text "GHC.Tc.Gen.Splice.reifyInstances"
pprHsDocContext (ForeignDeclCtx name)
= text "the foreign declaration for" <+> quotes (ppr name)
diff --git a/compiler/GHC/Runtime/Eval.hs b/compiler/GHC/Runtime/Eval.hs
index 794aa30b55..a67207c411 100644
--- a/compiler/GHC/Runtime/Eval.hs
+++ b/compiler/GHC/Runtime/Eval.hs
@@ -65,9 +65,9 @@ import GHC.Core.FVs ( orphNamesOfFamInst )
import GHC.Core.TyCon
import GHC.Core.Type hiding( typeKind )
import GHC.Types.RepType
-import TcType
-import Constraint
-import TcOrigin
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Origin
import GHC.Core.Predicate
import GHC.Types.Var
import GHC.Types.Id as Id
@@ -111,18 +111,18 @@ import Data.Array
import Exception
import Unsafe.Coerce ( unsafeCoerce )
-import TcRnDriver ( runTcInteractive, tcRnType, loadUnqualIfaces )
-import TcHsSyn ( ZonkFlexi (SkolemiseFlexi) )
+import GHC.Tc.Module ( runTcInteractive, tcRnType, loadUnqualIfaces )
+import GHC.Tc.Utils.Zonk ( ZonkFlexi (SkolemiseFlexi) )
-import TcEnv (tcGetInstEnvs)
+import GHC.Tc.Utils.Env (tcGetInstEnvs)
-import Inst (instDFunType)
-import TcSimplify (solveWanteds)
-import TcRnMonad
-import TcEvidence
+import GHC.Tc.Utils.Instantiate (instDFunType)
+import GHC.Tc.Solver (solveWanteds)
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Evidence
import Data.Bifunctor (second)
-import TcSMonad (runTcS)
+import GHC.Tc.Solver.Monad (runTcS)
-- -----------------------------------------------------------------------------
-- running a statement interactively
diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs
index b176c4bfc2..d4dfa49ca1 100644
--- a/compiler/GHC/Runtime/Heap/Inspect.hs
+++ b/compiler/GHC/Runtime/Heap/Inspect.hs
@@ -38,12 +38,12 @@ import GHC.Core.Type
import GHC.Types.RepType
import qualified GHC.Core.Unify as U
import GHC.Types.Var
-import TcRnMonad
-import TcType
-import TcMType
-import TcHsSyn ( zonkTcTypeToTypeX, mkEmptyZonkEnv, ZonkFlexi( RuntimeUnkFlexi ) )
-import TcUnify
-import TcEnv
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.Zonk ( zonkTcTypeToTypeX, mkEmptyZonkEnv, ZonkFlexi( RuntimeUnkFlexi ) )
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Utils.Env
import GHC.Core.TyCon
import GHC.Types.Name
@@ -566,7 +566,7 @@ traceTR :: SDoc -> TR ()
traceTR = liftTcM . traceOptTcRn Opt_D_dump_rtti
--- Semantically different to recoverM in TcRnMonad
+-- Semantically different to recoverM in GHC.Tc.Utils.Monad
-- recoverM retains the errors in the first action,
-- whereas recoverTc here does not
recoverTR :: TR a -> TR a -> TR a
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs
index 48ce94a710..434f4dd29d 100644
--- a/compiler/GHC/Runtime/Linker.hs
+++ b/compiler/GHC/Runtime/Linker.hs
@@ -38,7 +38,7 @@ import GHC.Iface.Load
import GHC.ByteCode.Linker
import GHC.ByteCode.Asm
import GHC.ByteCode.Types
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Driver.Packages as Packages
import GHC.Driver.Phases
import GHC.Driver.Finder
diff --git a/compiler/GHC/Runtime/Loader.hs b/compiler/GHC/Runtime/Loader.hs
index 16c965701a..5bad947b2a 100644
--- a/compiler/GHC/Runtime/Loader.hs
+++ b/compiler/GHC/Runtime/Loader.hs
@@ -28,9 +28,9 @@ import GHC.Runtime.Interpreter ( wormhole, withInterp )
import GHC.Runtime.Interpreter.Types
import GHC.Types.SrcLoc ( noSrcSpan )
import GHC.Driver.Finder ( findPluginModule, cannotFindModule )
-import TcRnMonad ( initTcInteractive, initIfaceTcRn )
+import GHC.Tc.Utils.Monad ( initTcInteractive, initIfaceTcRn )
import GHC.Iface.Load ( loadPluginInterface )
-import GHC.Types.Name.Reader ( RdrName, ImportSpec(..), ImpDeclSpec(..)
+import GHC.Types.Name.Reader ( RdrName, ImportSpec(..), ImpDeclSpec(..)
, ImpItemSpec(..), mkGlobalRdrEnv, lookupGRE_RdrName
, gre_name, mkRdrQual )
import GHC.Types.Name.Occurrence ( OccName, mkVarOcc )
diff --git a/compiler/GHC/StgToCmm/Closure.hs b/compiler/GHC/StgToCmm/Closure.hs
index 3aa9dc8ef4..b7e7c48fa0 100644
--- a/compiler/GHC/StgToCmm/Closure.hs
+++ b/compiler/GHC/StgToCmm/Closure.hs
@@ -80,7 +80,7 @@ import GHC.Core.DataCon
import GHC.Types.Name
import GHC.Core.Type
import GHC.Core.TyCo.Rep
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.TyCon
import GHC.Types.RepType
import GHC.Types.Basic
@@ -487,7 +487,7 @@ avoid a space leak, deliberately recomputing a thunk. Also (and this
really does happen occasionally) let-floating may make a function f smaller
so it can be inlined, so now (f True) may generate a local no-fv closure.
This actually happened during bootstrapping GHC itself, with f=mkRdrFunBind
-in TcGenDeriv.) -}
+in GHC.Tc.Deriv.Generate.) -}
-----------------------------------------------------------------------------
-- getCallMethod
diff --git a/compiler/GHC/StgToCmm/Ticky.hs b/compiler/GHC/StgToCmm/Ticky.hs
index 48f2e99bd6..19ff523fba 100644
--- a/compiler/GHC/StgToCmm/Ticky.hs
+++ b/compiler/GHC/StgToCmm/Ticky.hs
@@ -132,7 +132,7 @@ import GHC.Driver.Session
-- Turgid imports for showTypeCategory
import PrelNames
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.TyCon
import GHC.Core.Predicate
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/GHC/Tc/Deriv.hs
index 506ae1a1fc..9831c841e4 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/GHC/Tc/Deriv.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Handles @deriving@ clauses on @data@ declarations.
-}
{-# LANGUAGE CPP #-}
@@ -12,7 +10,8 @@ Handles @deriving@ clauses on @data@ declarations.
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcDeriv ( tcDeriving, DerivInfo(..) ) where
+-- | Handles @deriving@ clauses on @data@ declarations.
+module GHC.Tc.Deriv ( tcDeriving, DerivInfo(..) ) where
#include "HsVersions.h"
@@ -21,28 +20,28 @@ import GhcPrelude
import GHC.Hs
import GHC.Driver.Session
-import TcRnMonad
-import FamInst
-import TcOrigin
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Instance.Family
+import GHC.Tc.Types.Origin
import GHC.Core.Predicate
-import TcDerivInfer
-import TcDerivUtils
-import TcValidity( allDistinctTyVars )
-import TcClassDcl( instDeclCtxt3, tcATDefault )
-import TcEnv
-import TcGenDeriv -- Deriv stuff
-import TcValidity( checkValidInstHead )
+import GHC.Tc.Deriv.Infer
+import GHC.Tc.Deriv.Utils
+import GHC.Tc.Validity( allDistinctTyVars )
+import GHC.Tc.TyCl.Class( instDeclCtxt3, tcATDefault )
+import GHC.Tc.Utils.Env
+import GHC.Tc.Deriv.Generate
+import GHC.Tc.Validity( checkValidInstHead )
import GHC.Core.InstEnv
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.Core.FamInstEnv
-import TcHsType
+import GHC.Tc.Gen.HsType
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr ( pprTyVars )
import GHC.Rename.Names ( extendGlobalRdrEnvRn )
-import GHC.Rename.Binds
+import GHC.Rename.Bind
import GHC.Rename.Env
-import GHC.Rename.Source ( addTcgDUs )
+import GHC.Rename.Module ( addTcgDUs )
import GHC.Types.Avail
import GHC.Core.Unify( tcUnifyTy )
@@ -55,7 +54,7 @@ import GHC.Types.Name.Reader
import GHC.Types.Name
import GHC.Types.Name.Set as NameSet
import GHC.Core.TyCon
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Types.Var as Var
import GHC.Types.Var.Env
import GHC.Types.Var.Set
@@ -101,7 +100,7 @@ data EarlyDerivSpec = InferTheta (DerivSpec [ThetaOrigin])
--
-- GivenTheta ds => the exact context for the instance is supplied
-- by the programmer; it is ds_theta
- -- See Note [Inferring the instance context] in TcDerivInfer
+ -- See Note [Inferring the instance context] in GHC.Tc.Deriv.Infer
splitEarlyDerivSpec :: [EarlyDerivSpec]
-> ([DerivSpec [ThetaOrigin]], [DerivSpec ThetaType])
@@ -180,7 +179,7 @@ data DerivInfo = DerivInfo { di_rep_tc :: TyCon
************************************************************************
* *
-\subsection[TcDeriv-driver]{Top-level function for \tr{derivings}}
+Top-level function for \tr{derivings}
* *
************************************************************************
-}
@@ -191,7 +190,7 @@ tcDeriving :: [DerivInfo] -- All `deriving` clauses
tcDeriving deriv_infos deriv_decls
= recoverM (do { g <- getGblEnv
; return (g, emptyBag, emptyValBindsOut)}) $
- do { -- Fish the "deriving"-related information out of the TcEnv
+ do { -- Fish the "deriving"-related information out of the GHC.Tc.Utils.Env
-- And make the necessary "equations".
early_specs <- makeDerivSpecs deriv_infos deriv_decls
; traceTc "tcDeriving" (ppr early_specs)
@@ -284,7 +283,7 @@ renameDeriv inst_infos bagBinds
-- KindSignatures
setXOptM LangExt.TypeApplications $
-- GND/DerivingVia uses TypeApplications in generated code
- -- (See Note [Newtype-deriving instances] in TcGenDeriv)
+ -- (See Note [Newtype-deriving instances] in GHC.Tc.Deriv.Generate)
unsetXOptM LangExt.RebindableSyntax $
-- See Note [Avoid RebindableSyntax when deriving]
setXOptM LangExt.TemplateHaskellQuotes $
@@ -622,7 +621,7 @@ deriveStandalone (L loc (DerivDecl _ deriv_ty mb_lderiv_strat overlap_mode))
= setSrcSpan loc $
addErrCtxt (standaloneCtxt deriv_ty) $
do { traceTc "Standalone deriving decl for" (ppr deriv_ty)
- ; let ctxt = TcOrigin.InstDeclCtxt True
+ ; let ctxt = GHC.Tc.Types.Origin.InstDeclCtxt True
; traceTc "Deriving strategy (standalone deriving)" $
vcat [ppr mb_lderiv_strat, ppr deriv_ty]
; (mb_lderiv_strat, via_tvs) <- tcDerivStrategy mb_lderiv_strat
@@ -682,7 +681,7 @@ deriveStandalone (L loc (DerivDecl _ deriv_ty mb_lderiv_strat overlap_mode))
, text "deriv_ctxt':" <+> ppr deriv_ctxt'
, text "cls:" <+> ppr cls
, text "inst_tys':" <+> ppr inst_tys' ]
- -- C.f. TcInstDcls.tcLocalInstDecl1
+ -- C.f. GHC.Tc.TyCl.Instance.tcLocalInstDecl1
; if className cls == typeableClassName
then do warnUselessTypeable
@@ -704,7 +703,7 @@ deriveStandalone (L _ (XDerivDecl nec)) = noExtCon nec
-- as the 'DerivContext', where loc is the location of the wildcard used for
-- error reporting. This indicates that we should infer the context as if we
-- were deriving Eq via a deriving clause
--- (see Note [Inferring the instance context] in TcDerivInfer).
+-- (see Note [Inferring the instance context] in GHC.Tc.Deriv.Infer).
--
-- If there is no wildcard, then proceed as normal, and instead return
-- @'SupplyContext' theta@, where theta is the typechecked context.
@@ -1198,7 +1197,7 @@ mkEqnHelp overlap_mode tvs cls cls_args deriv_ctxt deriv_strat = do
-- @expectNonNullaryClsArgs inst_tys@ checks if @inst_tys@ is non-empty.
-- If so, return @(init inst_tys, last inst_tys)@.
-- Otherwise, throw an error message.
--- See @Note [DerivEnv and DerivSpecMechanism]@ in "TcDerivUtils" for why this
+-- See @Note [DerivEnv and DerivSpecMechanism]@ in "GHC.Tc.Deriv.Utils" for why this
-- property is important.
expectNonNullaryClsArgs :: [Type] -> DerivM ([Type], Type)
expectNonNullaryClsArgs inst_tys =
@@ -1209,7 +1208,7 @@ expectNonNullaryClsArgs inst_tys =
-- of an algebraic type constructor. If so, return a 'DerivInstTys' consisting
-- of @cls_tys@ and the constituent pars of @inst_ty@.
-- Otherwise, throw an error message.
--- See @Note [DerivEnv and DerivSpecMechanism]@ in "TcDerivUtils" for why this
+-- See @Note [DerivEnv and DerivSpecMechanism]@ in "GHC.Tc.Deriv.Utils" for why this
-- property is important.
expectAlgTyConApp :: [Type] -- All but the last argument to the class in a
-- derived instance
@@ -1228,7 +1227,7 @@ expectAlgTyConApp cls_tys inst_ty = do
-- @expectNonDataFamTyCon dit@ checks if @dit_rep_tc dit@ is a representation
-- type constructor for a data family instance, and if not,
-- throws an error message.
--- See @Note [DerivEnv and DerivSpecMechanism]@ in "TcDerivUtils" for why this
+-- See @Note [DerivEnv and DerivSpecMechanism]@ in "GHC.Tc.Deriv.Utils" for why this
-- property is important.
expectNonDataFamTyCon :: DerivInstTys -> DerivM ()
expectNonDataFamTyCon (DerivInstTys { dit_tc = tc
@@ -1417,7 +1416,7 @@ mk_eqn_no_strategy = do
-> do -- Otherwise, our only other options are stock or anyclass.
-- If it is stock, we must confirm that the last argument's
-- type constructor is algebraic.
- -- See Note [DerivEnv and DerivSpecMechanism] in TcDerivUtils
+ -- See Note [DerivEnv and DerivSpecMechanism] in GHC.Tc.Deriv.Utils
whenIsJust (hasStockDeriving cls) $ \_ ->
expectNonDataFamTyCon dit
mk_eqn_originative dit
@@ -1773,7 +1772,7 @@ The same criteria apply to DerivingVia.
************************************************************************
* *
-\subsection[TcDeriv-normal-binds]{Bindings for the various classes}
+Bindings for the various classes
* *
************************************************************************
@@ -1869,7 +1868,7 @@ genInst spec@(DS { ds_tvs = tvs, ds_mechanism = mechanism
LangExt.ImpredicativeTypes, LangExt.RankNTypes
-- ...and this flag is needed to support the instance signatures
-- that bring type variables into scope.
- -- See Note [Newtype-deriving instances] in TcGenDeriv
+ -- See Note [Newtype-deriving instances] in GHC.Tc.Deriv.Generate
, LangExt.InstanceSigs
]
| otherwise
@@ -2122,7 +2121,7 @@ is used:
In the latter case, we must take care to check if C has any associated type
families with default instances, because -XDeriveAnyClass will never provide
an implementation for them. We "fill in" the default instances using the
-tcATDefault function from TcClassDcl (which is also used in TcInstDcls to
+tcATDefault function from GHC.Tc.TyCl.Class (which is also used in GHC.Tc.TyCl.Instance to
handle the empty instance declaration case).
Note [Deriving strategies]
@@ -2165,12 +2164,12 @@ Currently, the deriving strategies are:
The latter two strategies (newtype and via) are referred to as the
"coerce-based" strategies, since they generate code that relies on the `coerce`
-function. See, for instance, TcDerivInfer.inferConstraintsCoerceBased.
+function. See, for instance, GHC.Tc.Deriv.Infer.inferConstraintsCoerceBased.
The former two strategies (stock and anyclass), in contrast, are
referred to as the "originative" strategies, since they create "original"
instances instead of "reusing" old instances (by way of `coerce`).
-See, for instance, TcDerivUtils.checkOriginativeSideConditions.
+See, for instance, GHC.Tc.Deriv.Utils.checkOriginativeSideConditions.
If an explicit deriving strategy is not given, GHC has an algorithm it uses to
determine which strategy it will actually use. The algorithm is quite long,
@@ -2186,7 +2185,7 @@ ask for a particular DerivStrategy (using the algorithm linked to above).
Note [Deriving instances for classes themselves]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Much of the code in TcDeriv assumes that deriving only works on data types.
+Much of the code in GHC.Tc.Deriv assumes that deriving only works on data types.
But this assumption doesn't hold true for DeriveAnyClass, since it's perfectly
reasonable to do something like this:
@@ -2205,7 +2204,7 @@ derivable class, and C2 isn't a newtype).
************************************************************************
* *
-\subsection[TcDeriv-taggery-Names]{What con2tag/tag2con functions are available?}
+What con2tag/tag2con functions are available?
* *
************************************************************************
-}
diff --git a/compiler/typecheck/TcGenFunctor.hs b/compiler/GHC/Tc/Deriv/Functor.hs
index c326754b20..d727d7bb98 100644
--- a/compiler/typecheck/TcGenFunctor.hs
+++ b/compiler/GHC/Tc/Deriv/Functor.hs
@@ -1,9 +1,6 @@
{-
(c) The University of Glasgow 2011
-
-The deriving code for the Functor, Foldable, and Traversable classes
-(equivalent to the code in TcGenDeriv, for other classes)
-}
{-# LANGUAGE CPP #-}
@@ -12,12 +9,18 @@ The deriving code for the Functor, Foldable, and Traversable classes
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
-module TcGenFunctor (
- FFoldType(..), functorLikeTraverse,
- deepSubtypesContaining, foldDataConArgs,
+-- | The deriving code for the Functor, Foldable, and Traversable classes
+module GHC.Tc.Deriv.Functor
+ ( FFoldType(..)
+ , functorLikeTraverse
+ , deepSubtypesContaining
+ , foldDataConArgs
- gen_Functor_binds, gen_Foldable_binds, gen_Traversable_binds
- ) where
+ , gen_Functor_binds
+ , gen_Foldable_binds
+ , gen_Traversable_binds
+ )
+where
#include "HsVersions.h"
@@ -32,8 +35,8 @@ import PrelNames
import GHC.Types.Name.Reader
import GHC.Types.SrcLoc
import State
-import TcGenDeriv
-import TcType
+import GHC.Tc.Deriv.Generate
+import GHC.Tc.Utils.TcType
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep
import GHC.Core.Type
@@ -1271,7 +1274,7 @@ a method-specific fashion to form the final generated expression).
Deriving Generic1 also does validity checking by looking for the last type
variable in certain positions of a constructor's argument types, so it also
-uses foldDataConArgs. See Note [degenerate use of FFoldType] in TcGenGenerics.
+uses foldDataConArgs. See Note [degenerate use of FFoldType] in GHC.Tc.Deriv.Generics.
Note [Generated code for DeriveFoldable and DeriveTraversable]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/GHC/Tc/Deriv/Generate.hs
index 0a2ab47e9b..27e73b6330 100644
--- a/compiler/typecheck/TcGenDeriv.hs
+++ b/compiler/GHC/Tc/Deriv/Generate.hs
@@ -3,13 +3,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-TcGenDeriv: Generating derived instance declarations
-
-This module is nominally ``subordinate'' to @TcDeriv@, which is the
-``official'' interface to deriving-related things.
-
-This is where we do all the grimy bindings' generation.
-}
{-# LANGUAGE CPP, ScopedTypeVariables #-}
@@ -18,7 +11,13 @@ This is where we do all the grimy bindings' generation.
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcGenDeriv (
+-- | Generating derived instance declarations
+--
+-- This module is nominally ``subordinate'' to @GHC.Tc.Deriv@, which is the
+-- ``official'' interface to deriving-related things.
+--
+-- This is where we do all the grimy bindings' generation.
+module GHC.Tc.Deriv.Generate (
BagDerivStuff, DerivStuff(..),
gen_Eq_binds,
@@ -41,7 +40,7 @@ module TcGenDeriv (
import GhcPrelude
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Hs
import GHC.Types.Name.Reader
import GHC.Types.Basic
@@ -52,7 +51,7 @@ import Encoding
import GHC.Driver.Session
import PrelInfo
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import PrelNames
import THNames
@@ -60,9 +59,9 @@ import GHC.Types.Id.Make ( coerceId )
import PrimOp
import GHC.Types.SrcLoc
import GHC.Core.TyCon
-import TcEnv
-import TcType
-import TcValidity ( checkValidCoAxBranch )
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Validity ( checkValidCoAxBranch )
import GHC.Core.Coercion.Axiom ( coAxiomSingleBranch )
import TysPrim
import TysWiredIn
@@ -1199,7 +1198,7 @@ gen_Show_binds get_fixity loc tycon
show_arg :: RdrName -> Type -> LHsExpr GhcPs
show_arg b arg_ty
| isUnliftedType arg_ty
- -- See Note [Deriving and unboxed types] in TcDerivInfer
+ -- See Note [Deriving and unboxed types] in GHC.Tc.Deriv.Infer
= with_conv $
nlHsApps compose_RDR
[mk_shows_app boxed_arg, mk_showString_app postfixMod]
@@ -1650,7 +1649,7 @@ wreak havoc with the Coercible solver. Therefore, we instead use type
applications, which do not deeply skolemize and thus avoid this issue.
The downside is that we currently require -XImpredicativeTypes to permit this
polymorphic type instantiation, so we have to switch that flag on locally in
-TcDeriv.genInst. See #8503 for more discussion.
+GHC.Tc.Deriv.genInst. See #8503 for more discussion.
Note [Newtype-deriving trickiness]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1718,7 +1717,7 @@ prove it *without computing any term evidence* (hence the <no-ev>). Alas, we
*must* generate a term-level evidence binding in order to instantiate the
quantified constraint! In response, GHC currently chooses not to use such
a quantified constraint.
-See Note [Instances in no-evidence implications] in TcInteract.
+See Note [Instances in no-evidence implications] in GHC.Tc.Solver.Interact.
But this isn't the death knell for combining QuantifiedConstraints with GND.
On the contrary, if we generate GND bindings in a slightly different way, then
@@ -1870,7 +1869,7 @@ gen_Newtype_binds loc cls inst_tvs inst_tys rhs_ty
rep_lhs_tys
let axiom = mkSingleCoAxiom Nominal rep_tc_name rep_tvs' [] rep_cvs'
fam_tc rep_lhs_tys rep_rhs_ty
- -- Check (c) from Note [GND and associated type families] in TcDeriv
+ -- Check (c) from Note [GND and associated type families] in GHC.Tc.Deriv
checkValidCoAxBranch fam_tc (coAxiomSingleBranch axiom)
newFamInst SynFamilyInst axiom
where
@@ -2124,14 +2123,14 @@ box :: String -- The class involved
-> LHsExpr GhcPs -- The argument
-> Type -- The argument type
-> LHsExpr GhcPs -- Boxed version of the arg
--- See Note [Deriving and unboxed types] in TcDerivInfer
+-- See Note [Deriving and unboxed types] in GHC.Tc.Deriv.Infer
box cls_str arg arg_ty = assoc_ty_id cls_str boxConTbl arg_ty arg
---------------------
primOrdOps :: String -- The class involved
-> Type -- The type
-> (RdrName, RdrName, RdrName, RdrName, RdrName) -- (lt,le,eq,ge,gt)
--- See Note [Deriving and unboxed types] in TcDerivInfer
+-- See Note [Deriving and unboxed types] in GHC.Tc.Deriv.Infer
primOrdOps str ty = assoc_ty_id str ordOpTbl ty
ordOpTbl :: [(Type, (RdrName, RdrName, RdrName, RdrName, RdrName))]
diff --git a/compiler/typecheck/TcGenGenerics.hs b/compiler/GHC/Tc/Deriv/Generics.hs
index a6193ed7c4..d40824e3ea 100644
--- a/compiler/typecheck/TcGenGenerics.hs
+++ b/compiler/GHC/Tc/Deriv/Generics.hs
@@ -1,9 +1,6 @@
{-
(c) The University of Glasgow 2011
-
-The deriving code for the Generic class
-(equivalent to the code in TcGenDeriv, for other classes)
-}
{-# LANGUAGE CPP, ScopedTypeVariables, TupleSections #-}
@@ -12,21 +9,27 @@ The deriving code for the Generic class
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcGenGenerics (canDoGenerics, canDoGenerics1,
- GenericKind(..),
- gen_Generic_binds, get_gen1_constrained_tys) where
+-- | The deriving code for the Generic class
+module GHC.Tc.Deriv.Generics
+ (canDoGenerics
+ , canDoGenerics1
+ , GenericKind(..)
+ , gen_Generic_binds
+ , get_gen1_constrained_tys
+ )
+where
import GhcPrelude
import GHC.Hs
import GHC.Core.Type
-import TcType
-import TcGenDeriv
-import TcGenFunctor
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Deriv.Generate
+import GHC.Tc.Deriv.Functor
import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Core.FamInstEnv ( FamInst, FamFlavor(..), mkSingleCoAxiom )
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Types.Module ( moduleName, moduleNameFS
, moduleUnitId, unitIdFS, getModule )
import GHC.Iface.Env ( newGlobalBinder )
@@ -36,8 +39,8 @@ import GHC.Types.Basic
import TysPrim
import TysWiredIn
import PrelNames
-import TcEnv
-import TcRnMonad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Monad
import GHC.Driver.Types
import ErrUtils( Validity(..), andValid )
import GHC.Types.SrcLoc
@@ -84,8 +87,9 @@ gen_Generic_binds gk tc inst_tys = do
-}
get_gen1_constrained_tys :: TyVar -> Type -> [Type]
--- called by TcDeriv.inferConstraints; generates a list of types, each of which
--- must be a Functor in order for the Generic1 instance to work.
+-- called by GHC.Tc.Deriv.Infer.inferConstraints; generates a list of
+-- types, each of which must be a Functor in order for the Generic1 instance to
+-- work.
get_gen1_constrained_tys argVar
= argTyFold argVar $ ArgTyAlg { ata_rec0 = const []
, ata_par1 = [], ata_rec1 = const []
@@ -915,7 +919,7 @@ kind binder, e.g.,
instance Generic1 (P *) where
type Rep1 (P *) = (... (Rec0 k)) -- wrong!
-See Note [Unify kinds in deriving] in TcDeriv.
+See Note [Unify kinds in deriving] in GHC.Tc.Deriv.
In any such scenario, we must prevent a discrepancy between the LHS and RHS of
a Rep(1) instance. To do so, we create a type variable substitution that maps
diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/GHC/Tc/Deriv/Infer.hs
index 079414d604..47257d6b23 100644
--- a/compiler/typecheck/TcDerivInfer.hs
+++ b/compiler/GHC/Tc/Deriv/Infer.hs
@@ -2,14 +2,17 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Functions for inferring (and simplifying) the context for derived instances.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE MultiWayIf #-}
-module TcDerivInfer (inferConstraints, simplifyInstanceContexts) where
+-- | Functions for inferring (and simplifying) the context for derived instances.
+module GHC.Tc.Deriv.Infer
+ ( inferConstraints
+ , simplifyInstanceContexts
+ )
+where
#include "HsVersions.h"
@@ -20,27 +23,27 @@ import GHC.Types.Basic
import GHC.Core.Class
import GHC.Core.DataCon
import ErrUtils
-import Inst
+import GHC.Tc.Utils.Instantiate
import Outputable
import Pair
import PrelNames
-import TcDerivUtils
-import TcEnv
-import TcGenDeriv
-import TcGenFunctor
-import TcGenGenerics
-import TcMType
-import TcRnMonad
-import TcOrigin
-import Constraint
+import GHC.Tc.Deriv.Utils
+import GHC.Tc.Utils.Env
+import GHC.Tc.Deriv.Generate
+import GHC.Tc.Deriv.Functor
+import GHC.Tc.Deriv.Generics
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Origin
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.TyCon
import GHC.Core.TyCo.Ppr (pprTyVars)
import GHC.Core.Type
-import TcSimplify
-import TcValidity (validDerivPred)
-import TcUnify (buildImplicationFor, checkConstraints)
+import GHC.Tc.Solver
+import GHC.Tc.Validity (validDerivPred)
+import GHC.Tc.Utils.Unify (buildImplicationFor, checkConstraints)
import TysWiredIn (typeToTypeKind)
import GHC.Core.Unify (tcUnifyTy)
import Util
@@ -495,7 +498,7 @@ Note [Deriving and unboxed types]
We have some special hacks to support things like
data T = MkT Int# deriving ( Show )
-Specifically, we use TcGenDeriv.box to box the Int# into an Int
+Specifically, we use GHC.Tc.Deriv.Generate.box to box the Int# into an Int
(which we know how to show), and append a '#'. Parentheses are not required
for unboxed values (`MkT -3#` is a valid expression).
@@ -661,7 +664,7 @@ simplifyInstanceContexts infer_specs
iterate_deriv n current_solns
| n > 20 -- Looks as if we are in an infinite loop
-- This can happen if we have -XUndecidableInstances
- -- (See TcSimplify.tcSimplifyDeriv.)
+ -- (See GHC.Tc.Solver.tcSimplifyDeriv.)
= pprPanic "solveDerivEqns: probable loop"
(vcat (map pprDerivSpec infer_specs) $$ ppr current_solns)
| otherwise
@@ -692,7 +695,7 @@ simplifyInstanceContexts infer_specs
-- checkValidInstance tyvars theta clas inst_tys
-- Not necessary; see Note [Exotic derived instance contexts]
- ; traceTc "TcDeriv" (ppr deriv_rhs $$ ppr theta)
+ ; traceTc "GHC.Tc.Deriv" (ppr deriv_rhs $$ ppr theta)
-- Claim: the result instance declaration is guaranteed valid
-- Hence no need to call:
-- checkValidInstance tyvars theta clas inst_tys
diff --git a/compiler/typecheck/TcDerivUtils.hs b/compiler/GHC/Tc/Deriv/Utils.hs
index 0f72eea2e2..5394a09e23 100644
--- a/compiler/typecheck/TcDerivUtils.hs
+++ b/compiler/GHC/Tc/Deriv/Utils.hs
@@ -2,13 +2,12 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Error-checking and other utilities for @deriving@ clauses or declarations.
-}
{-# LANGUAGE TypeFamilies #-}
-module TcDerivUtils (
+-- | Error-checking and other utilities for @deriving@ clauses or declarations.
+module GHC.Tc.Deriv.Utils (
DerivM, DerivEnv(..),
DerivSpec(..), pprDerivSpec, DerivInstTys(..),
DerivSpecMechanism(..), derivSpecMechanismToStrategy, isDerivSpecStock,
@@ -33,7 +32,7 @@ import GHC.Driver.Session
import ErrUtils
import GHC.Driver.Types (lookupFixity, mi_fix)
import GHC.Hs
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.Core.InstEnv
import GHC.Iface.Load (loadInterfaceForName)
import GHC.Types.Module (getModule)
@@ -41,12 +40,12 @@ import GHC.Types.Name
import Outputable
import PrelNames
import GHC.Types.SrcLoc
-import TcGenDeriv
-import TcGenFunctor
-import TcGenGenerics
-import TcOrigin
-import TcRnMonad
-import TcType
+import GHC.Tc.Deriv.Generate
+import GHC.Tc.Deriv.Functor
+import GHC.Tc.Deriv.Generics
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
import THNames (liftClassKey)
import GHC.Core.TyCon
import GHC.Core.TyCo.Ppr (pprSourceTyCon)
@@ -60,7 +59,7 @@ import qualified GHC.LanguageExtensions as LangExt
import ListSetOps (assocMaybe)
-- | To avoid having to manually plumb everything in 'DerivEnv' throughout
--- various functions in @TcDeriv@ and @TcDerivInfer@, we use 'DerivM', which
+-- various functions in @GHC.Tc.Deriv@ and @GHC.Tc.Deriv.Infer@, we use 'DerivM', which
-- is a simple reader around 'TcRn'.
type DerivM = ReaderT DerivEnv TcRn
@@ -136,7 +135,7 @@ data DerivSpec theta = DS { ds_loc :: SrcSpan
, ds_overlap :: Maybe OverlapMode
, ds_standalone_wildcard :: Maybe SrcSpan
-- See Note [Inferring the instance context]
- -- in TcDerivInfer
+ -- in GHC.Tc.Deriv.Infer
, ds_mechanism :: DerivSpecMechanism }
-- This spec implies a dfun declaration of the form
-- df :: forall tvs. theta => C tys
@@ -147,7 +146,7 @@ data DerivSpec theta = DS { ds_loc :: SrcSpan
-- or the not-yet-simplified list of constraints together with their origin
-- ds_mechanism specifies the means by which GHC derives the instance.
- -- See Note [Deriving strategies] in TcDeriv
+ -- See Note [Deriving strategies] in GHC.Tc.Deriv
{-
Example:
@@ -209,7 +208,7 @@ instance Outputable DerivInstTys where
-- | What action to take in order to derive a class instance.
-- See @Note [DerivEnv and DerivSpecMechanism]@, as well as
--- @Note [Deriving strategies]@ in "TcDeriv".
+-- @Note [Deriving strategies]@ in "GHC.Tc.Deriv".
data DerivSpecMechanism
-- | \"Standard\" classes
= DerivSpecStock
@@ -230,7 +229,7 @@ data DerivSpecMechanism
-- instance. As examples, derived 'Generic' instances require
-- associated type family instances, and derived 'Eq' and 'Ord'
-- instances require top-level @con2tag@ functions.
- -- See @Note [Auxiliary binders]@ in "TcGenDeriv".
+ -- See @Note [Auxiliary binders]@ in "GHC.Tc.Deriv.Generate".
--
-- 3. @[Name]@: A list of Names for which @-Wunused-binds@ should be
-- suppressed. This is used to suppress unused warnings for record
@@ -302,7 +301,7 @@ instance Outputable DerivSpecMechanism where
Note [DerivEnv and DerivSpecMechanism]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DerivEnv contains all of the bits and pieces that are common to every
-deriving strategy. (See Note [Deriving strategies] in TcDeriv.) Some deriving
+deriving strategy. (See Note [Deriving strategies] in GHC.Tc.Deriv.) Some deriving
strategies impose stricter requirements on the types involved in the derived
instance than others, and these differences are factored out into the
DerivSpecMechanism type. Suppose that the derived instance looks like this:
@@ -316,7 +315,7 @@ Each deriving strategy imposes restrictions on arg_1 through arg_n as follows:
Stock deriving requires that:
- n must be a positive number. This is checked by
- TcDeriv.expectNonNullaryClsArgs
+ GHC.Tc.Deriv.expectNonNullaryClsArgs
- arg_n must be an application of an algebraic type constructor. Here,
"algebraic type constructor" means:
@@ -324,7 +323,7 @@ Each deriving strategy imposes restrictions on arg_1 through arg_n as follows:
+ A data family type constructor such that the arguments it is applied to
give rise to a data family instance.
- This is checked by TcDeriv.expectAlgTyConApp.
+ This is checked by GHC.Tc.Deriv.expectAlgTyConApp.
This extra structure is witnessed by the DerivInstTys data type, which stores
arg_1 through arg_(n-1) (dit_cls_tys), the algebraic type constructor
@@ -421,7 +420,7 @@ instance Outputable DerivContext where
-- | Records whether a particular class can be derived by way of an
-- /originative/ deriving strategy (i.e., @stock@ or @anyclass@).
--
--- See @Note [Deriving strategies]@ in "TcDeriv".
+-- See @Note [Deriving strategies]@ in "GHC.Tc.Deriv".
data OriginativeDerivStatus
= CanDeriveStock -- Stock class, can derive
(SrcSpan -> TyCon -> [Type]
@@ -500,7 +499,7 @@ data PredOrigin = PredOrigin PredType CtOrigin TypeOrKind
-- it appears in neither 'to_anyclass_skols' nor 'to_anyclass_metas'.)
--
-- See @Note [Gathering and simplifying constraints for DeriveAnyClass]@
--- in "TcDerivInfer" for an explanation of how 'to_wanted_origins' are
+-- in "GHC.Tc.Deriv.Infer" for an explanation of how 'to_wanted_origins' are
-- determined in @DeriveAnyClass@, as well as how 'to_anyclass_skols',
-- 'to_anyclass_metas', and 'to_anyclass_givens' are used.
data ThetaOrigin
@@ -636,7 +635,7 @@ Currently, the only three stock derived classes that require this are Read,
Show, and Generic, as their derived code all depend on the record selectors
of the derived data type's constructors.
-See also Note [Newtype deriving and unused constructors] in TcDeriv for
+See also Note [Newtype deriving and unused constructors] in GHC.Tc.Deriv for
another example of a similar trick.
-}
@@ -660,7 +659,7 @@ getDataConFixityFun tc
------------------------------------------------------------------
-- Check side conditions that dis-allow derivability for the originative
-- deriving strategies (stock and anyclass).
--- See Note [Deriving strategies] in TcDeriv for an explanation of what
+-- See Note [Deriving strategies] in GHC.Tc.Deriv for an explanation of what
-- "originative" means.
--
-- This is *apart* from the coerce-based strategies, newtype and via.
@@ -954,7 +953,7 @@ cond_functorOK allowFunctions allowExQuantifiedLastTyVar _ _ rep_tc
check_universal con
| allowExQuantifiedLastTyVar
= IsValid -- See Note [DeriveFoldable with ExistentialQuantification]
- -- in TcGenFunctor
+ -- in GHC.Tc.Deriv.Functor
| Just tv <- getTyVar_maybe (last (tyConAppArgs (dataConOrigResTy con)))
, tv `elem` dataConUnivTyVars con
, not (tv `elemVarSet` exactTyCoVarsOfTypes (dataConTheta con))
@@ -1021,7 +1020,7 @@ newDerivClsInst theta (DS { ds_name = dfun_name, ds_overlap = overlap_mode
extendLocalInstEnv :: [ClsInst] -> TcM a -> TcM a
-- Add new locally-defined instances; don't bother to check
--- for functional dependency errors -- that'll happen in TcInstDcls
+-- for functional dependency errors -- that'll happen in GHC.Tc.TyCl.Instance
extendLocalInstEnv dfuns thing_inside
= do { env <- getGblEnv
; let inst_env' = extendInstEnvList (tcg_inst_env env) dfuns
@@ -1059,7 +1058,7 @@ This is not restricted to Generics; any class can be derived, simply giving
rise to an empty instance.
See Note [Gathering and simplifying constraints for DeriveAnyClass] in
-TcDerivInfer for an explanation hof how the instance context is inferred for
+GHC.Tc.Deriv.Infer for an explanation hof how the instance context is inferred for
DeriveAnyClass.
Note [Check that the type variable is truly universal]
@@ -1095,7 +1094,7 @@ As a result, T can have a derived Foldable instance:
foldr f z (T5 x) = f x z
foldr _ z T6 = z
-See Note [DeriveFoldable with ExistentialQuantification] in TcGenFunctor.
+See Note [DeriveFoldable with ExistentialQuantification] in GHC.Tc.Deriv.Functor.
For Functor and Traversable, we must take care not to let type synonyms
unfairly reject a type for not being truly universally quantified. An
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/GHC/Tc/Errors.hs
index 0fbef80ec0..74eb1cf45a 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -6,7 +6,7 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcErrors(
+module GHC.Tc.Errors(
reportUnsolved, reportAllUnsolved, warnAllUnsolved,
warnDefaulting,
@@ -17,15 +17,15 @@ module TcErrors(
import GhcPrelude
-import TcRnTypes
-import TcRnMonad
-import Constraint
+import GHC.Tc.Types
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcMType
-import TcUnify( occCheckForErrors, MetaTyVarUpdateResult(..) )
-import TcEnv( tcInitTidyEnv )
-import TcType
-import TcOrigin
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.Unify( occCheckForErrors, MetaTyVarUpdateResult(..) )
+import GHC.Tc.Utils.Env( tcInitTidyEnv )
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Origin
import GHC.Rename.Unbound ( unknownNameSuggestions )
import GHC.Core.Type
import GHC.Core.Coercion
@@ -33,15 +33,15 @@ import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr ( pprTyVars, pprWithExplicitKindsWhen, pprSourceTyCon, pprWithTYPE )
import GHC.Core.Unify ( tcMatchTys )
import GHC.Types.Module
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv ( flattenTys )
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.Core.InstEnv
import GHC.Core.TyCon
import GHC.Core.Class
import GHC.Core.DataCon
-import TcEvidence
-import TcEvTerm
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.EvTerm
import GHC.Hs.Binds ( PatSynBind(..) )
import GHC.Types.Name
import GHC.Types.Name.Reader ( lookupGRE_Name, GlobalRdrEnv, mkRdrUnqual )
@@ -69,7 +69,7 @@ import Control.Monad ( when )
import Data.Foldable ( toList )
import Data.List ( partition, mapAccumL, nub, sortBy, unfoldr )
-import {-# SOURCE #-} TcHoleErrors ( findValidHoleFits )
+import {-# SOURCE #-} GHC.Tc.Errors.Hole ( findValidHoleFits )
-- import Data.Semigroup ( Semigroup )
import qualified Data.Semigroup as Semigroup
@@ -102,7 +102,7 @@ Even though `a` is ill-typed, it is not used in the end, so if all that we're
interested in is `main` it is handy to be able to ignore the problems in `a`.
Since we treat type equalities as evidence, this is relatively simple. Whenever
-we run into a type mismatch in TcUnify, we normally just emit an error. But it
+we run into a type mismatch in GHC.Tc.Utils.Unify, we normally just emit an error. But it
is always safe to defer the mismatch to the main constraint solver. If we do
that, `a` will get transformed into
@@ -119,7 +119,7 @@ to compile, and it will run fine unless we evaluate `a`. This is what
`deferErrorsToRuntime` does.
It does this by keeping track of which errors correspond to which coercion
-in TcErrors. TcErrors.reportTidyWanteds does not print the errors
+in GHC.Tc.Errors. GHC.Tc.Errors.reportTidyWanteds does not print the errors
and does not fail if -fdefer-type-errors is on, so that we can continue
compilation. The errors are turned into warnings in `reportUnsolved`.
-}
@@ -166,7 +166,7 @@ reportUnsolved wanted
-- NB: Type-level holes are OK, because there are no bindings.
-- See Note [Deferring coercion errors to runtime]
-- Used by solveEqualities for kind equalities
--- (see Note [Fail fast on kind errors] in TcSimplify)
+-- (see Note [Fail fast on kind errors] in GHC.Tc.Solver)
-- and for simplifyDefault.
reportAllUnsolved :: WantedConstraints -> TcM ()
reportAllUnsolved wanted
@@ -183,7 +183,7 @@ reportAllUnsolved wanted
-- | Report all unsolved goals as warnings (but without deferring any errors to
-- run-time). See Note [Safe Haskell Overlapping Instances Implementation] in
--- TcSimplify
+-- GHC.Tc.Solver
warnAllUnsolved :: WantedConstraints -> TcM ()
warnAllUnsolved wanted
= do { ev_binds <- newTcEvBinds
@@ -232,7 +232,7 @@ report_unsolved type_errors expr_holes
-- Suppress low-priority errors if there
-- are insoluble errors anywhere;
-- See #15539 and c.f. setting ic_status
- -- in TcSimplify.setImplicationStatus
+ -- in GHC.Tc.Solver.setImplicationStatus
, cec_warn_redundant = warn_redundant
, cec_binds = binds_var }
@@ -458,7 +458,7 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs, ic_telescope = m_telescope
_ -> False
warnRedundantConstraints :: ReportErrCtxt -> TcLclEnv -> SkolemInfo -> [EvVar] -> TcM ()
--- See Note [Tracking redundant constraints] in TcSimplify
+-- See Note [Tracking redundant constraints] in GHC.Tc.Solver
warnRedundantConstraints ctxt env info ev_vars
| null redundant_evs
= return ()
@@ -559,7 +559,7 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
-- report1: ones that should *not* be suppressed by
-- an insoluble somewhere else in the tree
-- It's crucial that anything that is considered insoluble
- -- (see TcRnTypes.insolubleCt) is caught here, otherwise
+ -- (see GHC.Tc.Utils.insolubleCt) is caught here, otherwise
-- we might suppress its error message, and proceed on past
-- type checking to get a Lint error later
report1 = [ ("Out of scope", unblocked is_out_of_scope, True, mkHoleReporter tidy_cts)
@@ -576,7 +576,7 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
-- where alpha is untouchable; and representational equalities
-- Prefer homogeneous equalities over hetero, because the
-- former might be holding up the latter.
- -- See Note [Equalities with incompatible kinds] in TcCanonical
+ -- See Note [Equalities with incompatible kinds] in GHC.Tc.Solver.Canonical
, ("Homo eqs", unblocked is_homo_equality, True, mkGroupReporter mkEqErr)
, ("Other eqs", unblocked is_equality, True, mkGroupReporter mkEqErr)
, ("Blocked eqs", is_equality, False, mkSuppressReporter mkBlockedEqErr)]
@@ -655,7 +655,7 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
, not (ic_no_eqs implic)
, ic_warn_inaccessible implic
-- Don't bother doing this if -Winaccessible-code isn't enabled.
- -- See Note [Avoid -Winaccessible-code when deriving] in TcInstDcls.
+ -- See Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.
= True
| otherwise
= has_gadt_match implics
@@ -1488,7 +1488,7 @@ mkTyVarEqErr' dflags ctxt report ct oriented tv1 ty2
| not insoluble_occurs_check -- See Note [Occurs check wins]
, isUserSkolem ctxt tv1 -- ty2 won't be a meta-tyvar, or else the thing would
-- be oriented the other way round;
- -- see TcCanonical.canEqTyVarTyVar
+ -- see GHC.Tc.Solver.Canonical.canEqTyVarTyVar
|| isTyVarTyVar tv1 && not (isTyVarTy ty2)
|| ctEqRel ct == ReprEq
-- the cases below don't really apply to ReprEq (except occurs check)
@@ -1502,7 +1502,7 @@ mkTyVarEqErr' dflags ctxt report ct oriented tv1 ty2
-- We report an "occurs check" even for a ~ F t a, where F is a type
-- function; it's not insoluble (because in principle F could reduce)
-- but we have certainly been unable to solve it
- -- See Note [Occurs check error] in TcCanonical
+ -- See Note [Occurs check error] in GHC.Tc.Solver.Canonical
= do { let main_msg = addArising (ctOrigin ct) $
hang (text "Occurs check: cannot construct the infinite" <+> what <> colon)
2 (sep [ppr ty1, char '~', ppr ty2])
@@ -1732,7 +1732,7 @@ ic_no_eqs field), so the test above will keep it wholesale.
To refine this given, we apply mkMinimalBySCs on it to extract just the (a ~ b)
part. This works because mkMinimalBySCs eliminates reflexive equalities in
addition to superclasses (see Note [Remove redundant provided dicts]
-in TcPatSyn).
+in GHC.Tc.TyCl.PatSyn).
-}
extraTyVarEqInfo :: ReportErrCtxt -> TcTyVar -> TcType -> SDoc
@@ -2699,7 +2699,7 @@ up in the instance environment, lest we only report one matching
instance when in fact there are two.
Re-flattening is pretty easy, because we don't need to keep track of
-evidence. We don't re-use the code in TcCanonical because that's in
+evidence. We don't re-use the code in GHC.Tc.Solver.Canonical because that's in
the TcS monad, and we are in TcM here.
Note [Kind arguments in error messages]
diff --git a/compiler/typecheck/TcHoleErrors.hs b/compiler/GHC/Tc/Errors/Hole.hs
index 00a1a17226..b361ca597d 100644
--- a/compiler/typecheck/TcHoleErrors.hs
+++ b/compiler/GHC/Tc/Errors/Hole.hs
@@ -1,29 +1,31 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcHoleErrors ( findValidHoleFits, tcFilterHoleFits
- , tcCheckHoleFit, tcSubsumes
- , withoutUnification
- , fromPureHFPlugin
- -- Re-exports for convenience
- , hfIsLcl
- , pprHoleFit, debugHoleFitDispConfig
-
- -- Re-exported from TcHoleFitTypes
- , TypedHole (..), HoleFit (..), HoleFitCandidate (..)
- , CandPlugin, FitPlugin
- , HoleFitPlugin (..), HoleFitPluginR (..)
- ) where
+module GHC.Tc.Errors.Hole
+ ( findValidHoleFits, tcFilterHoleFits
+ , tcCheckHoleFit, tcSubsumes
+ , withoutUnification
+ , fromPureHFPlugin
+ -- Re-exports for convenience
+ , hfIsLcl
+ , pprHoleFit, debugHoleFitDispConfig
+
+ -- Re-exported from GHC.Tc.Errors.Hole.FitTypes
+ , TypedHole (..), HoleFit (..), HoleFitCandidate (..)
+ , CandPlugin, FitPlugin
+ , HoleFitPlugin (..), HoleFitPluginR (..)
+ )
+where
import GhcPrelude
-import TcRnTypes
-import TcRnMonad
-import Constraint
-import TcOrigin
-import TcMType
-import TcEvidence
-import TcType
+import GHC.Tc.Types
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.DataCon
import GHC.Types.Name
@@ -35,7 +37,7 @@ import GHC.Types.Var.Env
import Bag
import GHC.Core.ConLike ( ConLike(..) )
import Util
-import TcEnv (tcLookup)
+import GHC.Tc.Utils.Env (tcLookup)
import Outputable
import GHC.Driver.Session
import Maybes
@@ -48,8 +50,8 @@ import Data.List ( partition, sort, sortOn, nubBy )
import Data.Graph ( graphFromEdges, topSort )
-import TcSimplify ( simpl_top, runTcSDeriveds )
-import TcUnify ( tcSubType_NC )
+import GHC.Tc.Solver ( simpl_top, runTcSDeriveds )
+import GHC.Tc.Utils.Unify ( tcSubType_NC )
import GHC.HsToCore.Docs ( extractDocs )
import qualified Data.Map as Map
@@ -59,7 +61,7 @@ import GHC.Iface.Load ( loadInterfaceForNameMaybe )
import PrelInfo (knownKeyNames)
-import TcHoleFitTypes
+import GHC.Tc.Errors.Hole.FitTypes
{-
@@ -446,7 +448,7 @@ addDocs fits =
; mapM (upd lclDocs) fits }
else return fits }
where
- msg = text "TcHoleErrors addDocs"
+ msg = text "GHC.Tc.Errors.Hole addDocs"
lookupInIface name (ModIface { mi_decl_docs = DeclDocMap dmap })
= Map.lookup name dmap
upd lclDocs fit@(HoleFit {hfCand = cand}) =
diff --git a/compiler/GHC/Tc/Errors/Hole.hs-boot b/compiler/GHC/Tc/Errors/Hole.hs-boot
new file mode 100644
index 0000000000..bc79c3eed4
--- /dev/null
+++ b/compiler/GHC/Tc/Errors/Hole.hs-boot
@@ -0,0 +1,13 @@
+-- This boot file is in place to break the loop where:
+-- + GHC.Tc.Solver calls 'GHC.Tc.Errors.reportUnsolved',
+-- + which calls 'GHC.Tc.Errors.Hole.findValidHoleFits`
+-- + which calls 'GHC.Tc.Solver.simpl_top'
+module GHC.Tc.Errors.Hole where
+
+import GHC.Tc.Types ( TcM )
+import GHC.Tc.Types.Constraint ( Ct, Implication )
+import Outputable ( SDoc )
+import GHC.Types.Var.Env ( TidyEnv )
+
+findValidHoleFits :: TidyEnv -> [Implication] -> [Ct] -> Ct
+ -> TcM (TidyEnv, SDoc)
diff --git a/compiler/typecheck/TcHoleFitTypes.hs b/compiler/GHC/Tc/Errors/Hole/FitTypes.hs
index d27aa8fef7..8aabc615ce 100644
--- a/compiler/typecheck/TcHoleFitTypes.hs
+++ b/compiler/GHC/Tc/Errors/Hole/FitTypes.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE ExistentialQuantification #-}
-module TcHoleFitTypes (
+module GHC.Tc.Errors.Hole.FitTypes (
TypedHole (..), HoleFit (..), HoleFitCandidate (..),
CandPlugin, FitPlugin, HoleFitPlugin (..), HoleFitPluginR (..),
hfIsLcl, pprHoleFitCand
@@ -7,9 +7,9 @@ module TcHoleFitTypes (
import GhcPrelude
-import TcRnTypes
-import Constraint
-import TcType
+import GHC.Tc.Types
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Utils.TcType
import GHC.Types.Name.Reader
diff --git a/compiler/GHC/Tc/Errors/Hole/FitTypes.hs-boot b/compiler/GHC/Tc/Errors/Hole/FitTypes.hs-boot
new file mode 100644
index 0000000000..25d3f81aeb
--- /dev/null
+++ b/compiler/GHC/Tc/Errors/Hole/FitTypes.hs-boot
@@ -0,0 +1,10 @@
+-- This boot file is in place to break the loop where:
+-- + GHC.Tc.Types needs 'HoleFitPlugin',
+-- + which needs 'GHC.Tc.Errors.Hole.FitTypes'
+-- + which needs 'GHC.Tc.Types'
+module GHC.Tc.Errors.Hole.FitTypes where
+
+-- Build ordering
+import GHC.Base()
+
+data HoleFitPlugin
diff --git a/compiler/typecheck/TcAnnotations.hs b/compiler/GHC/Tc/Gen/Annotation.hs
index dcd78b5d71..00c52ea247 100644
--- a/compiler/typecheck/TcAnnotations.hs
+++ b/compiler/GHC/Tc/Gen/Annotation.hs
@@ -2,17 +2,17 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1993-1998
-\section[TcAnnotations]{Typechecking annotations}
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
-module TcAnnotations ( tcAnnotations, annCtxt ) where
+-- | Typechecking annotations
+module GHC.Tc.Gen.Annotation ( tcAnnotations, annCtxt ) where
import GhcPrelude
-import {-# SOURCE #-} TcSplice ( runAnnotation )
+import {-# SOURCE #-} GHC.Tc.Gen.Splice ( runAnnotation )
import GHC.Types.Module
import GHC.Driver.Session
import Control.Monad ( when )
@@ -20,7 +20,7 @@ import Control.Monad ( when )
import GHC.Hs
import GHC.Types.Name
import GHC.Types.Annotations
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.SrcLoc
import Outputable
import GHC.Driver.Types
diff --git a/compiler/typecheck/TcArrows.hs b/compiler/GHC/Tc/Gen/Arrow.hs
index 1b54417c85..435bf4d89c 100644
--- a/compiler/typecheck/TcArrows.hs
+++ b/compiler/GHC/Tc/Gen/Arrow.hs
@@ -2,7 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-Typecheck arrow notation
-}
{-# LANGUAGE RankNTypes, TupleSections #-}
@@ -10,26 +9,27 @@ Typecheck arrow notation
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcArrows ( tcProc ) where
+-- | Typecheck arrow notation
+module GHC.Tc.Gen.Arrow ( tcProc ) where
import GhcPrelude
-import {-# SOURCE #-} TcExpr( tcMonoExpr, tcInferRho, tcSyntaxOp, tcCheckId, tcPolyExpr )
+import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcMonoExpr, tcInferRho, tcSyntaxOp, tcCheckId, tcPolyExpr )
import GHC.Hs
-import TcMatches
-import TcHsSyn( hsLPatType )
-import TcType
-import TcMType
-import TcBinds
-import TcPat
-import TcUnify
-import TcRnMonad
-import TcEnv
-import TcOrigin
-import TcEvidence
+import GHC.Tc.Gen.Match
+import GHC.Tc.Utils.Zonk( hsLPatType )
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Gen.Bind
+import GHC.Tc.Gen.Pat
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Types.Origin
+import GHC.Tc.Types.Evidence
import GHC.Types.Id( mkLocalId )
-import Inst
+import GHC.Tc.Utils.Instantiate
import TysWiredIn
import GHC.Types.Var.Set
import TysPrim
@@ -216,7 +216,7 @@ tc_cmd env cmd@(HsCmdArrApp _ fun arg ho_app lr) (_, res_ty)
-- proc for the (-<) case.
-- Local bindings, inside the enclosing proc, are not in scope
-- inside f. In the higher-order case (-<<), they are.
- -- See Note [Escaping the arrow scope] in TcRnTypes
+ -- See Note [Escaping the arrow scope] in GHC.Tc.Types
select_arrow_scope tc = case ho_app of
HsHigherOrderApp -> tc
HsFirstOrderApp -> escapeArrowScope tc
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/GHC/Tc/Gen/Bind.hs
index 26e4ade66d..6750a77500 100644
--- a/compiler/typecheck/TcBinds.hs
+++ b/compiler/GHC/Tc/Gen/Bind.hs
@@ -2,7 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcBinds]{TcBinds}
-}
{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables #-}
@@ -10,35 +9,41 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
-module TcBinds ( tcLocalBinds, tcTopBinds, tcValBinds,
- tcHsBootSigs, tcPolyCheck,
- chooseInferredQuantifiers,
- badBootDeclErr ) where
+module GHC.Tc.Gen.Bind
+ ( tcLocalBinds
+ , tcTopBinds
+ , tcValBinds
+ , tcHsBootSigs
+ , tcPolyCheck
+ , chooseInferredQuantifiers
+ , badBootDeclErr
+ )
+where
import GhcPrelude
-import {-# SOURCE #-} TcMatches ( tcGRHSsPat, tcMatchesFun )
-import {-# SOURCE #-} TcExpr ( tcMonoExpr )
-import {-# SOURCE #-} TcPatSyn ( tcPatSynDecl, tcPatSynBuilderBind )
+import {-# SOURCE #-} GHC.Tc.Gen.Match ( tcGRHSsPat, tcMatchesFun )
+import {-# SOURCE #-} GHC.Tc.Gen.Expr ( tcMonoExpr )
+import {-# SOURCE #-} GHC.Tc.TyCl.PatSyn ( tcPatSynDecl, tcPatSynBuilderBind )
import GHC.Core (Tickish (..))
import GHC.Types.CostCentre (mkUserCC, CCFlavour(DeclCC))
import GHC.Driver.Session
import FastString
import GHC.Hs
-import TcSigs
-import TcRnMonad
-import TcOrigin
-import TcEnv
-import TcUnify
-import TcSimplify
-import TcEvidence
-import TcHsType
-import TcPat
-import TcMType
+import GHC.Tc.Gen.Sig
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Solver
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Gen.Pat
+import GHC.Tc.Utils.TcMType
import GHC.Core.FamInstEnv( normaliseType )
-import FamInst( tcGetFamInstEnvs )
+import GHC.Tc.Instance.Family( tcGetFamInstEnvs )
import GHC.Core.TyCon
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type (mkStrLitTy, tidyOpenType, splitTyConApp_maybe, mkCastTy)
import TysPrim
import TysWiredIn( mkBoxedTupleTy )
@@ -59,7 +64,7 @@ import Util
import GHC.Types.Basic
import Outputable
import PrelNames( ipClassName )
-import TcValidity (checkValidType)
+import GHC.Tc.Validity (checkValidType)
import GHC.Types.Unique.FM
import GHC.Types.Unique.Set
import qualified GHC.LanguageExtensions as LangExt
@@ -399,7 +404,7 @@ tcValBinds top_lvl binds sigs thing_inside
{ (binds', (extra_binds', thing)) <- tcBindGroups top_lvl sig_fn prag_fn binds $ do
{ thing <- thing_inside
-- See Note [Pattern synonym builders don't yield dependencies]
- -- in GHC.Rename.Binds
+ -- in GHC.Rename.Bind
; patsyn_builders <- mapM tcPatSynBuilderBind patsyns
; let extra_binds = [ (NonRecursive, builder) | builder <- patsyn_builders ]
; return (extra_binds, thing) }
@@ -832,7 +837,7 @@ mkExport :: TcPragEnv
-- the quantified type variables, so we can fix their final form
-- right now.
-- The latter is needed because the poly_ids are used to extend the
--- type environment; see the invariant on TcEnv.tcExtendIdEnv
+-- type environment; see the invariant on GHC.Tc.Utils.Env.tcExtendIdEnv
-- Pre-condition: the qtvs and theta are already zonked
@@ -895,7 +900,7 @@ mkInferredPolyId insoluble qtvs inferred_theta poly_name mb_sig_inst mono_ty
do { fam_envs <- tcGetFamInstEnvs
; let (_co, mono_ty') = normaliseType fam_envs Nominal mono_ty
-- Unification may not have normalised the type,
- -- (see Note [Lazy flattening] in TcFlatten) so do it
+ -- (see Note [Lazy flattening] in GHC.Tc.Solver.Flatten) so do it
-- here to make it as uncomplicated as possible.
-- Example: f :: [F Int] -> Bool
-- should be rewritten to f :: [Char] -> Bool, if possible
@@ -952,7 +957,7 @@ chooseInferredQuantifiers inferred_theta tau_tvs qtvs
-- Check whether a quantified variable of the partial type
-- signature is not actually quantified. How can that happen?
-- See Note [Quantification and partial signatures] Wrinkle 4
- -- in TcSimplify
+ -- in GHC.Tc.Solver
; mapM_ report_mono_sig_tv_err [ n | (n,tv) <- psig_qtv_prs
, not (tv `elem` qtvs) ]
@@ -1016,7 +1021,7 @@ chooseInferredQuantifiers inferred_theta tau_tvs qtvs
; case tcGetCastedTyVar_maybe wc_var_ty of
-- We know that wc_co must have type kind(wc_var) ~ Constraint, as it
- -- comes from the checkExpectedKind in TcHsType.tcAnonWildCardOcc. So, to
+ -- comes from the checkExpectedKind in GHC.Tc.Gen.HsType.tcAnonWildCardOcc. So, to
-- make the kinds work out, we reverse the cast here.
Just (wc_var, wc_co) -> writeMetaTyVar wc_var (ctuple `mkCastTy` mkTcSymCo wc_co)
Nothing -> pprPanic "chooseInferredQuantifiers 1" (ppr wc_var_ty)
@@ -1028,7 +1033,7 @@ chooseInferredQuantifiers inferred_theta tau_tvs qtvs
; return (free_tvs, my_theta) }
mk_ctuple preds = return (mkBoxedTupleTy preds)
- -- Hack alert! See TcHsType:
+ -- Hack alert! See GHC.Tc.Gen.HsType:
-- Note [Extra-constraint holes in partial type signatures]
@@ -1263,8 +1268,8 @@ tcMonoBinds is_rec sig_fn no_gen
setSrcSpan b_loc $
do { ((co_fn, matches'), rhs_ty)
<- tcInferInst $ \ exp_ty ->
- -- tcInferInst: see TcUnify,
- -- Note [Deep instantiation of InferResult] in TcUnify
+ -- tcInferInst: see GHC.Tc.Utils.Unify,
+ -- Note [Deep instantiation of InferResult] in GHC.Tc.Utils.Unify
tcExtendBinderStack [TcIdBndr_ExpType name exp_ty NotTopLevel] $
-- We extend the error context even for a non-recursive
-- function so that in type error messages we show the
@@ -1528,14 +1533,14 @@ We typecheck pattern bindings as follows. First tcLhs does this:
3. Invoke tcLetPat to typecheck the pattern.
- We pass in the current TcLevel. This is captured by
- TcPat.tcLetPat, and put into the pc_lvl field of PatCtxt, in
+ GHC.Tc.Gen.Pat.tcLetPat, and put into the pc_lvl field of PatCtxt, in
PatEnv.
- When tcPat finds an existential constructor, it binds fresh
type variables and dictionaries as usual, increments the TcLevel,
and emits an implication constraint.
- - When we come to a binder (TcPat.tcPatBndr), it looks it up
+ - When we come to a binder (GHC.Tc.Gen.Pat.tcPatBndr), it looks it up
in the little environment (the pc_sig_fn field of PatCtxt).
Success => There was a type signature, so just use it,
diff --git a/compiler/typecheck/TcDefaults.hs b/compiler/GHC/Tc/Gen/Default.hs
index e69ac2170d..ab3ef76fca 100644
--- a/compiler/typecheck/TcDefaults.hs
+++ b/compiler/GHC/Tc/Gen/Default.hs
@@ -2,23 +2,23 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1993-1998
-\section[TcDefaults]{Typechecking \tr{default} declarations}
-}
{-# LANGUAGE TypeFamilies #-}
-module TcDefaults ( tcDefaults ) where
+-- | Typechecking @default@ declarations
+module GHC.Tc.Gen.Default ( tcDefaults ) where
import GhcPrelude
import GHC.Hs
import GHC.Core.Class
-import TcRnMonad
-import TcEnv
-import TcHsType
-import TcHsSyn
-import TcSimplify
-import TcValidity
-import TcType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Solver
+import GHC.Tc.Validity
+import GHC.Tc.Utils.TcType
import PrelNames
import GHC.Types.SrcLoc
import Outputable
diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/GHC/Tc/Gen/Export.hs
index c7c2950e94..283bbce728 100644
--- a/compiler/typecheck/TcRnExports.hs
+++ b/compiler/GHC/Tc/Gen/Export.hs
@@ -5,16 +5,16 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
-module TcRnExports (tcRnExports, exports_from_avail) where
+module GHC.Tc.Gen.Export (tcRnExports, exports_from_avail) where
import GhcPrelude
import GHC.Hs
import PrelNames
import GHC.Types.Name.Reader
-import TcRnMonad
-import TcEnv
-import TcType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcType
import GHC.Rename.Names
import GHC.Rename.Env
import GHC.Rename.Unbound ( reportUnboundName )
@@ -461,14 +461,13 @@ If the module has a main function in scope:
There is no distinction between GHC and GHCi.
If the module has several main functions in scope:
Then generate a header as above. The ambiguity is reported later in
- module `TcRnDriver.hs` function `check_main`.
+ module `GHC.Tc.Module` function `check_main`.
If the module has NO main function:
Then export all top-level functions. This marks all top level
functions as 'used'.
In GHCi this has the effect, that we don't get any 'non-used' warnings.
- In GHC, however, the 'has-main-module' check in the module
- compiler/typecheck/TcRnDriver (functions checkMain / check-main) fires,
- and we get the error:
+ In GHC, however, the 'has-main-module' check in GHC.Tc.Module.checkMain
+ fires, and we get the error:
The IO action ‘main’ is not defined in module ‘Main’
-}
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/GHC/Tc/Gen/Expr.hs
index 63824f5cbe..55f2a105c6 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/GHC/Tc/Gen/Expr.hs
@@ -3,7 +3,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcExpr]{Typecheck an expression}
-}
{-# LANGUAGE CPP, TupleSections, ScopedTypeVariables #-}
@@ -12,44 +11,56 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcExpr ( tcPolyExpr, tcMonoExpr, tcMonoExprNC,
- tcInferSigma, tcInferSigmaNC, tcInferRho, tcInferRhoNC,
- tcSyntaxOp, tcSyntaxOpGen, SyntaxOpType(..), synKnownType,
- tcCheckId,
- addExprErrCtxt,
- addAmbiguousNameErr,
- getFixedTyVars ) where
+-- | Typecheck an expression
+module GHC.Tc.Gen.Expr
+ ( tcPolyExpr
+ , tcMonoExpr
+ , tcMonoExprNC
+ , tcInferSigma
+ , tcInferSigmaNC
+ , tcInferRho
+ , tcInferRhoNC
+ , tcSyntaxOp
+ , tcSyntaxOpGen
+ , SyntaxOpType(..)
+ , synKnownType
+ , tcCheckId
+ , addExprErrCtxt
+ , addAmbiguousNameErr
+ , getFixedTyVars
+ )
+where
#include "HsVersions.h"
import GhcPrelude
-import {-# SOURCE #-} TcSplice( tcSpliceExpr, tcTypedBracket, tcUntypedBracket )
+import {-# SOURCE #-} GHC.Tc.Gen.Splice( tcSpliceExpr, tcTypedBracket, tcUntypedBracket )
import THNames( liftStringName, liftName )
import GHC.Hs
-import Constraint ( HoleSort(..) )
-import TcHsSyn
-import TcRnMonad
-import TcUnify
+import GHC.Tc.Types.Constraint ( HoleSort(..) )
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Unify
import GHC.Types.Basic
-import Inst
-import TcBinds ( chooseInferredQuantifiers, tcLocalBinds )
-import TcSigs ( tcUserTypeSig, tcInstSig )
-import TcSimplify ( simplifyInfer, InferMode(..) )
-import FamInst ( tcGetFamInstEnvs, tcLookupDataFamInst )
-import GHC.Core.FamInstEnv ( FamInstEnvs )
-import GHC.Rename.Env ( addUsedGRE )
-import GHC.Rename.Utils ( addNameClashErrRn, unknownSubordinateErr )
-import TcEnv
-import TcArrows
-import TcMatches
-import TcHsType
-import TcPatSyn( tcPatSynBuilderOcc, nonBidirectionalErr )
-import TcPat
-import TcMType
-import TcOrigin
-import TcType
+import GHC.Tc.Utils.Instantiate
+import GHC.Tc.Gen.Bind ( chooseInferredQuantifiers, tcLocalBinds )
+import GHC.Tc.Gen.Sig ( tcUserTypeSig, tcInstSig )
+import GHC.Tc.Solver ( simplifyInfer, InferMode(..) )
+import GHC.Tc.Instance.Family ( tcGetFamInstEnvs, tcLookupDataFamInst )
+import GHC.Core.FamInstEnv ( FamInstEnvs )
+import GHC.Rename.Env ( addUsedGRE )
+import GHC.Rename.Utils ( addNameClashErrRn, unknownSubordinateErr )
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.Arrow
+import GHC.Tc.Gen.Match
+import GHC.Tc.Gen.HsType
+import GHC.Tc.TyCl.PatSyn ( tcPatSynBuilderOcc, nonBidirectionalErr )
+import GHC.Tc.Gen.Pat
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcType as TcType
import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Core.ConLike
@@ -64,7 +75,7 @@ import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr
import GHC.Core.TyCo.Subst (substTyWithInScope)
import GHC.Core.Type
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Types.Var.Set
import TysWiredIn
import TysPrim( intPrimTy )
@@ -539,7 +550,7 @@ tcExpr (HsIf x NoSyntaxExprRn pred b1 b2) res_ty -- Ordinary 'if'
= do { pred' <- tcMonoExpr pred (mkCheckExpType boolTy)
; res_ty <- tauifyExpType res_ty
-- Just like Note [Case branches must never infer a non-tau type]
- -- in TcMatches (See #10619)
+ -- in GHC.Tc.Gen.Match (See #10619)
; b1' <- tcMonoExpr b1 res_ty
; b2' <- tcMonoExpr b2 res_ty
@@ -559,7 +570,7 @@ tcExpr (HsMultiIf _ alts) res_ty
= do { res_ty <- if isSingleton alts
then return res_ty
else tauifyExpType res_ty
- -- Just like TcMatches
+ -- Just like GHC.Tc.Gen.Match
-- Note [Case branches must never infer a non-tau type]
; alts' <- mapM (wrapLocM $ tcGRHS match_ctxt res_ty) alts
@@ -719,7 +730,7 @@ The criterion we use is this:
of the data constructor
NB: this is not (quite) the same as being a "naughty" record selector
-(See Note [Naughty record selectors]) in TcTyClsDecls), at least
+(See Note [Naughty record selectors]) in GHC.Tc.TyCl), at least
in the case of GADTs. Consider
data T a where { MkT :: { f :: a } :: T [a] }
Then f is not "naughty" because it has a well-typed record selector.
@@ -886,7 +897,7 @@ tcExpr expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = rbnds }) res_ty
mk_inst_ty :: TCvSubst -> (TyVar, TcType) -> TcM (TCvSubst, TcType)
-- Deals with instantiation of kind variables
- -- c.f. TcMType.newMetaTyVars
+ -- c.f. GHC.Tc.Utils.TcMType.newMetaTyVars
mk_inst_ty subst (tv, result_inst_ty)
| is_fixed_tv tv -- Same as result type
= return (extendTvSubst subst tv result_inst_ty, result_inst_ty)
@@ -1179,7 +1190,7 @@ mk_app_msg fun args = sep [ text "The" <+> text what <+> quotes (ppr expr)
what | null type_app_args = "function"
| otherwise = "expression"
-- Include visible type arguments (but not other arguments) in the herald.
- -- See Note [Herald for matchExpectedFunTys] in TcUnify.
+ -- See Note [Herald for matchExpectedFunTys] in GHC.Tc.Utils.Unify.
expr = mkHsAppTypes fun type_app_args
type_app_args = [hs_ty | HsTypeArg _ hs_ty <- args]
@@ -1201,8 +1212,8 @@ tcInferFun (L loc (HsRecFld _ f))
tcInferFun fun
= tcInferSigma fun
- -- NB: tcInferSigma; see TcUnify
- -- Note [Deep instantiation of InferResult] in TcUnify
+ -- NB: tcInferSigma; see GHC.Tc.Utils.Unify
+ -- Note [Deep instantiation of InferResult] in GHC.Tc.Utils.Unify
----------------
@@ -1221,7 +1232,7 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald
-- Don't count visible type arguments when determining how many arguments
-- an expression is given in an arity mismatch error, since visible type
-- arguments reported as a part of the expression herald itself.
- -- See Note [Herald for matchExpectedFunTys] in TcUnify.
+ -- See Note [Herald for matchExpectedFunTys] in GHC.Tc.Utils.Unify.
orig_expr_args_arity = count isHsValArg orig_args
fun_is_out_of_scope -- See Note [VTA for out-of-scope functions]
@@ -1673,7 +1684,7 @@ should behave like
So for partial signatures we apply the MR if no context is given. So
e :: IO _ apply the MR
e :: _ => IO _ do not apply the MR
-just like in TcBinds.decideGeneralisationPlan
+just like in GHC.Tc.Gen.Bind.decideGeneralisationPlan
This makes a difference (#11670):
peek :: Ptr a -> IO CLong
@@ -2699,7 +2710,7 @@ mixedSelectors data_sels@(dc_rep_id:_) pat_syn_sels@(ps_rep_id:_)
where
RecSelPatSyn rep_ps = recordSelectorTyCon ps_rep_id
RecSelData rep_dc = recordSelectorTyCon dc_rep_id
-mixedSelectors _ _ = panic "TcExpr: mixedSelectors emptylists"
+mixedSelectors _ _ = panic "GHC.Tc.Gen.Expr: mixedSelectors emptylists"
missingStrictFields :: ConLike -> [FieldLabelString] -> SDoc
diff --git a/compiler/typecheck/TcExpr.hs-boot b/compiler/GHC/Tc/Gen/Expr.hs-boot
index 6c2c3bb733..27ebefc9a3 100644
--- a/compiler/typecheck/TcExpr.hs-boot
+++ b/compiler/GHC/Tc/Gen/Expr.hs-boot
@@ -1,10 +1,10 @@
-module TcExpr where
+module GHC.Tc.Gen.Expr where
import GHC.Types.Name
-import GHC.Hs ( HsExpr, LHsExpr, SyntaxExprRn, SyntaxExprTc )
-import TcType ( TcRhoType, TcSigmaType, SyntaxOpType, ExpType, ExpRhoType )
-import TcRnTypes( TcM )
-import TcOrigin ( CtOrigin )
-import GHC.Hs.Extension ( GhcRn, GhcTcId )
+import GHC.Hs ( HsExpr, LHsExpr, SyntaxExprRn, SyntaxExprTc )
+import GHC.Tc.Utils.TcType ( TcRhoType, TcSigmaType, SyntaxOpType, ExpType, ExpRhoType )
+import GHC.Tc.Types ( TcM )
+import GHC.Tc.Types.Origin ( CtOrigin )
+import GHC.Hs.Extension ( GhcRn, GhcTcId )
tcPolyExpr ::
LHsExpr GhcRn
diff --git a/compiler/typecheck/TcForeign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index f050d2a992..050f3b5b89 100644
--- a/compiler/typecheck/TcForeign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -2,20 +2,20 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1998
-\section[TcForeign]{Typechecking \tr{foreign} declarations}
-
-A foreign declaration is used to either give an externally
-implemented function a Haskell type (and calling interface) or
-give a Haskell function an external calling interface. Either way,
-the range of argument and result types these functions can accommodate
-is restricted to what the outside world understands (read C), and this
-module checks to see if a foreign declaration has got a legal type.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeFamilies #-}
-module TcForeign
+-- | Typechecking \tr{foreign} declarations
+--
+-- A foreign declaration is used to either give an externally
+-- implemented function a Haskell type (and calling interface) or
+-- give a Haskell function an external calling interface. Either way,
+-- the range of argument and result types these functions can accommodate
+-- is restricted to what the outside world understands (read C), and this
+-- module checks to see if a foreign declaration has got a legal type.
+module GHC.Tc.Gen.Foreign
( tcForeignImports
, tcForeignExports
@@ -37,12 +37,12 @@ import GhcPrelude
import GHC.Hs
-import TcRnMonad
-import TcHsType
-import TcExpr
-import TcEnv
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Gen.Expr
+import GHC.Tc.Utils.Env
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import GHC.Core.Coercion
import GHC.Core.Type
@@ -53,7 +53,7 @@ import GHC.Types.Name
import GHC.Types.Name.Reader
import GHC.Core.DataCon
import GHC.Core.TyCon
-import TcType
+import GHC.Tc.Utils.TcType
import PrelNames
import GHC.Driver.Session
import Outputable
@@ -86,7 +86,7 @@ newtype Age = MkAge Int
we want to see that Age -> IO () is the same as Int -> IO (). But, we don't
need to recur on any type parameters, because no paramaterized types (with
interesting parameters) are marshalable! The full list of marshalable types
-is in the body of boxedMarshalableTyCon in TcType. The only members of that
+is in the body of boxedMarshalableTyCon in GHC.Tc.Utils.TcType. The only members of that
list not at kind * are Ptr, FunPtr, and StablePtr, all of which get marshaled
the same way regardless of type parameter. So, no need to recur into
parameters.
@@ -215,7 +215,7 @@ Here again 'MkD' is used.
So we really have wait until the type checker to decide what is used.
That's why tcForeignImports and tecForeignExports return a (Bag GRE)
-for the newtype constructors they see. Then TcRnDriver can add them
+for the newtype constructors they see. Then GHC.Tc.Module can add them
to the module's usages.
@@ -254,7 +254,7 @@ tcFImport (L dloc fo@(ForeignImport { fd_name = L nloc nm, fd_sig_ty = hs_ty
id = mkLocalId nm sig_ty
-- Use a LocalId to obey the invariant that locally-defined
-- things are LocalIds. However, it does not need zonking,
- -- (so TcHsSyn.zonkForeignExports ignores it).
+ -- (so GHC.Tc.Utils.Zonk.zonkForeignExports ignores it).
; imp_decl' <- tcCheckFIType arg_tys res_ty imp_decl
-- Can't use sig_ty here because sig_ty :: Type and
diff --git a/compiler/typecheck/TcHsType.hs b/compiler/GHC/Tc/Gen/HsType.hs
index 37bfda6e9f..c7a7f298f5 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/GHC/Tc/Gen/HsType.hs
@@ -2,7 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcMonoType]{Typechecking user-specified @MonoTypes@}
-}
{-# LANGUAGE CPP, TupleSections, MultiWayIf, RankNTypes #-}
@@ -13,7 +12,8 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcHsType (
+-- | Typechecking user-specified @MonoTypes@
+module GHC.Tc.Gen.HsType (
-- Type signatures
kcClassSigType, tcClassSigType,
tcHsSigType, tcHsSigWcType,
@@ -71,23 +71,23 @@ module TcHsType (
import GhcPrelude
import GHC.Hs
-import TcRnMonad
-import TcOrigin
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Origin
import GHC.Core.Predicate
-import Constraint
-import TcEvidence
-import TcEnv
-import TcMType
-import TcValidity
-import TcUnify
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Validity
+import GHC.Tc.Utils.Unify
import GHC.IfaceToCore
-import TcSimplify
-import TcHsSyn
+import GHC.Tc.Solver
+import GHC.Tc.Utils.Zonk
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr
-import TcErrors ( reportAllUnsolved )
-import TcType
-import Inst ( tcInstInvisibleTyBinders, tcInstInvisibleTyBinder )
+import GHC.Tc.Errors ( reportAllUnsolved )
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.Instantiate ( tcInstInvisibleTyBinders, tcInstInvisibleTyBinder )
import GHC.Core.Type
import TysPrim
import GHC.Types.Name.Reader( lookupLocalRdrOcc )
@@ -132,7 +132,7 @@ to HsTypes to make the error messages sane.
During type-checking, we perform as little validity checking as possible.
Generally, after type-checking, you will want to do validity checking, say
-with TcValidity.checkValidType.
+with GHC.Tc.Validity.checkValidType.
Validity checking
~~~~~~~~~~~~~~~~~
@@ -254,7 +254,7 @@ tcHsSigType ctxt sig_ty
; ty <- zonkTcType ty
; when insol failM
- -- See Note [Fail fast if there are insoluble kind equalities] in TcSimplify
+ -- See Note [Fail fast if there are insoluble kind equalities] in GHC.Tc.Solver
; checkValidType ctxt ty
; traceTc "end tcHsSigType }" (ppr ty)
@@ -296,7 +296,7 @@ tc_hs_sig_type skol_info hs_sig_type ctxt_kind
; spec_tkvs <- zonkAndScopedSort spec_tkvs
; let ty1 = mkSpecForAllTys spec_tkvs ty
- -- This bit is very much like decideMonoTyVars in TcSimplify,
+ -- This bit is very much like decideMonoTyVars in GHC.Tc.Solver,
-- but constraints are so much simpler in kinds, it is much
-- easier here. (In particular, we never quantify over a
-- constraint in a type.)
@@ -401,7 +401,7 @@ tcHsClsInstType user_ctxt hs_inst_ty
----------------------------------------------
-- | Type-check a visible type application
tcHsTypeApp :: LHsWcType GhcRn -> Kind -> TcM Type
--- See Note [Recipe for checking a signature] in TcHsType
+-- See Note [Recipe for checking a signature] in GHC.Tc.Gen.HsType
tcHsTypeApp wc_ty kind
| HsWC { hswc_ext = sig_wcs, hswc_body = hs_ty } <- wc_ty
= do { ty <- solveLocalEqualities "tcHsTypeApp" $
@@ -1496,7 +1496,7 @@ tc_lhs_pred mode pred = tc_lhs_type mode pred constraintKind
---------------------------
tcTyVar :: TcTyMode -> Name -> TcM (TcType, TcKind)
-- See Note [Type checking recursive type and class declarations]
--- in TcTyClsDecls
+-- in GHC.Tc.TyCl
tcTyVar mode name -- Could be a tyvar, a tycon, or a datacon
= do { traceTc "lk1" (ppr name)
; thing <- tcLookup name
@@ -1646,7 +1646,7 @@ The type desugarer is phase 2 of dealing with HsTypes. Specifically:
* It zonks any kinds. The returned type should have no mutable kind
or type variables (hence returning Type not TcType):
- any unconstrained kind variables are defaulted to (Any *) just
- as in TcHsSyn.
+ as in GHC.Tc.Utils.Zonk.
- there are no mutable type variables because we are
kind-checking a type
Reason: the returned type may be put in a TyCon or DataCon where
@@ -1749,7 +1749,7 @@ the surrounding context, we must obey the following dictum:
Every metavariable in a type must either be
(A) generalized, or
(B) promoted, or See Note [Promotion in signatures]
- (C) a cause to error See Note [Naughty quantification candidates] in TcMType
+ (C) a cause to error See Note [Naughty quantification candidates] in GHC.Tc.Utils.TcMType
The kindGeneralize functions do not require pre-zonking; they zonk as they
go.
@@ -1767,7 +1767,7 @@ If an unsolved metavariable in a signature is not generalized
(because we're not generalizing the construct -- e.g., pattern
sig -- or because the metavars are constrained -- see kindGeneralizeSome)
we need to promote to maintain (WantedTvInv) of Note [TcLevel and untouchable type variables]
-in TcType. Note that promotion is identical in effect to generalizing
+in GHC.Tc.Utils.TcType. Note that promotion is identical in effect to generalizing
and the reinstantiating with a fresh metavariable at the current level.
So in some sense, we generalize *all* variables, but then re-instantiate
some of them.
@@ -1881,7 +1881,7 @@ kcCheckDeclHeader_cusk name flav
(HsQTvs { hsq_ext = kv_ns
, hsq_explicit = hs_tvs }) kc_res_ki
-- CUSK case
- -- See note [Required, Specified, and Inferred for types] in TcTyClsDecls
+ -- See note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
= addTyConFlavCtxt name flav $
do { (scoped_kvs, (tc_tvs, res_kind))
<- pushTcLevelM_ $
@@ -1924,7 +1924,7 @@ kcCheckDeclHeader_cusk name flav
True -- it is generalised
flav
-- If the ordering from
- -- Note [Required, Specified, and Inferred for types] in TcTyClsDecls
+ -- Note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
-- doesn't work, we catch it here, before an error cascade
; checkTyConTelescope tycon
@@ -1963,26 +1963,26 @@ kcInferDeclHeader name flav
(HsQTvs { hsq_ext = kv_ns
, hsq_explicit = hs_tvs }) kc_res_ki
-- No standalane kind signature and no CUSK.
- -- See note [Required, Specified, and Inferred for types] in TcTyClsDecls
+ -- See note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
= addTyConFlavCtxt name flav $
do { (scoped_kvs, (tc_tvs, res_kind))
-- Why bindImplicitTKBndrs_Q_Tv which uses newTyVarTyVar?
- -- See Note [Inferring kinds for type declarations] in TcTyClsDecls
+ -- See Note [Inferring kinds for type declarations] in GHC.Tc.TyCl
<- bindImplicitTKBndrs_Q_Tv kv_ns $
bindExplicitTKBndrs_Q_Tv ctxt_kind hs_tvs $
newExpectedKind =<< kc_res_ki
-- Why "_Tv" not "_Skol"? See third wrinkle in
- -- Note [Inferring kinds for type declarations] in TcTyClsDecls,
+ -- Note [Inferring kinds for type declarations] in GHC.Tc.TyCl,
; let -- NB: Don't add scoped_kvs to tyConTyVars, because they
-- might unify with kind vars in other types in a mutually
-- recursive group.
- -- See Note [Inferring kinds for type declarations] in TcTyClsDecls
+ -- See Note [Inferring kinds for type declarations] in GHC.Tc.TyCl
tc_binders = mkAnonTyConBinders VisArg tc_tvs
-- Also, note that tc_binders has the tyvars from only the
-- user-written tyvarbinders. See S1 in Note [How TcTyCons work]
- -- in TcTyClsDecls
+ -- in GHC.Tc.TyCl
--
-- mkAnonTyConBinder: see Note [No polymorphic recursion]
@@ -2483,7 +2483,7 @@ What should be the kind of `T` in the following example? (#15591)
class C (a :: Type) where
type T (x :: f a)
-As per Note [Ordering of implicit variables] in GHC.Rename.Types, we want to quantify
+As per Note [Ordering of implicit variables] in GHC.Rename.HsType, we want to quantify
the kind variables in left-to-right order of first occurrence in order to
support visible kind application. But we cannot perform this analysis on just
T alone, since its variable `a` actually occurs /before/ `f` if you consider
@@ -2537,7 +2537,7 @@ expectedKindInCtxt (TySynCtxt _) = AnyKind
expectedKindInCtxt ThBrackCtxt = AnyKind
expectedKindInCtxt (GhciCtxt {}) = AnyKind
-- The types in a 'default' decl can have varying kinds
--- See Note [Extended defaults]" in TcEnv
+-- See Note [Extended defaults]" in GHC.Tc.Utils.Env
expectedKindInCtxt DefaultDeclCtxt = AnyKind
expectedKindInCtxt TypeAppCtxt = AnyKind
expectedKindInCtxt (ForSigCtxt _) = TheKind liftedTypeKind
@@ -2695,7 +2695,7 @@ bindExplicitTKBndrsX tc_tv hs_tvs thing_inside
-- is mentioned in the kind of a later binder
-- e.g. forall k (a::k). blah
-- NB: tv's Name may differ from hs_tv's
- -- See TcMType Note [Cloning for tyvar binders]
+ -- See GHC.Tc.Utils.TcMType Note [Cloning for tyvar binders]
; (tvs,res) <- tcExtendNameTyVarEnv [(hsTyVarName hs_tv, tv)] $
go hs_tvs
; return (tv:tvs, res) }
@@ -2776,7 +2776,7 @@ zonkAndScopedSort spec_tkvs
-- Use zonkAndSkolemise because a skol_tv might be a TyVarTv
-- Do a stable topological sort, following
- -- Note [Ordering of implicit variables] in GHC.Rename.Types
+ -- Note [Ordering of implicit variables] in GHC.Rename.HsType
; return (scopedSort spec_tkvs) }
-- | Generalize some of the free variables in the given type.
@@ -2789,7 +2789,7 @@ zonkAndScopedSort spec_tkvs
-- you likely need to push the level before creating whatever type
-- gets passed here. Any variable whose level is greater than the
-- ambient level but is not selected to be generalized will be
--- promoted. (See [Promoting unification variables] in TcSimplify
+-- promoted. (See [Promoting unification variables] in GHC.Tc.Solver
-- and Note [Recipe for checking a signature].)
-- The resulting KindVar are the variables to
-- quantify over, in the correct, well-scoped order. They should
@@ -2921,7 +2921,7 @@ etaExpandAlgTyCon :: [TyConBinder]
-- Never emits constraints.
-- It's a little trickier than you might think: see
-- Note [TyConBinders for the result kind signature of a data type]
--- See Note [Datatype return kinds] in TcTyClsDecls
+-- See Note [Datatype return kinds] in GHC.Tc.TyCl
etaExpandAlgTyCon tc_bndrs kind
= do { loc <- getSrcSpanM
; uniqs <- newUniqueSupply
@@ -2982,7 +2982,7 @@ data DataSort
-- If the declaration is a @newtype@ or @newtype instance@ and the
-- @UnliftedNewtypes@ extension is enabled, this check is slightly relaxed so
-- that a return kind of the form @TYPE r@ (for some @r@) is permitted.
--- See @Note [Implementation of UnliftedNewtypes]@ in "TcTyClsDecls".
+-- See @Note [Implementation of UnliftedNewtypes]@ in "GHC.Tc.TyCl".
--
-- If dealing with a @data family@ declaration, check that the return kind is
-- either of the form:
@@ -2991,7 +2991,7 @@ data DataSort
--
-- 2. @k@ (where @k@ is a bare kind variable; see #12369)
--
--- See also Note [Datatype return kinds] in TcTyClsDecls
+-- See also Note [Datatype return kinds] in GHC.Tc.TyCl
checkDataKindSig :: DataSort -> Kind -> TcM ()
checkDataKindSig data_sort kind = do
dflags <- getDynFlags
@@ -3026,7 +3026,7 @@ checkDataKindSig data_sort kind = do
-- With UnliftedNewtypes, we allow kinds other than Type, but they
-- must still be of the form `TYPE r` since we don't want to accept
-- Constraint or Nat.
- -- See Note [Implementation of UnliftedNewtypes] in TcTyClsDecls.
+ -- See Note [Implementation of UnliftedNewtypes] in GHC.Tc.TyCl.
|| is_data_family
-- If this is a `data family` declaration, we don't need to check if
-- UnliftedNewtypes is enabled, since data family declarations can
@@ -3163,7 +3163,7 @@ tcHsPartialSigType ctxt sig_ty
do { (implicit_tvs, (explicit_tvs, (wcs, wcx, theta, tau)))
<- solveLocalEqualities "tcHsPartialSigType" $
-- This solveLocalEqualiltes fails fast if there are
- -- insoluble equalities. See TcSimplify
+ -- insoluble equalities. See GHC.Tc.Solver
-- Note [Fail fast if there are insoluble kind equalities]
tcNamedWildCardBinders sig_wcs $ \ wcs ->
bindImplicitTKBndrs_Tv implicit_hs_tvs $
@@ -3223,7 +3223,7 @@ When we have a partial signature like
f,g :: forall a. a -> _
we do the following
-* In TcSigs.tcUserSigType we return a PartialSig, which (unlike
+* In GHC.Tc.Gen.Sig.tcUserSigType we return a PartialSig, which (unlike
the companion CompleteSig) contains the original, as-yet-unchecked
source-code LHsSigWcType
@@ -3255,10 +3255,10 @@ Consider
* Then, in tcHsPartialSigType, we make a new hole TcTyVar, in
tcWildCardBinders.
-* TcBinds.chooseInferredQuantifiers fills in that hole TcTyVar
+* GHC.Tc.Gen.Bind.chooseInferredQuantifiers fills in that hole TcTyVar
with the inferred constraints, e.g. (Eq a, Show a)
-* TcErrors.mkHoleError finally reports the error.
+* GHC.Tc.Errors.mkHoleError finally reports the error.
An annoying difficulty happens if there are more than 62 inferred
constraints. Then we need to fill in the TcTyVar with (say) a 70-tuple.
@@ -3271,7 +3271,7 @@ in the hole, to communicate to the error reporting machinery. Nothing
more. So I use a HACK:
* I make an /ordinary/ tuple of the constraints, in
- TcBinds.chooseInferredQuantifiers. This is ill-kinded because
+ GHC.Tc.Gen.Bind.chooseInferredQuantifiers. This is ill-kinded because
ordinary tuples can't contain constraints, but it works fine. And for
ordinary tuples we don't have the same limit as for constraint
tuples (which need selectors and an associated class).
@@ -3399,7 +3399,7 @@ patBindSigErr sig_tvs
{- Note [Pattern signature binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-See also Note [Type variables in the type environment] in TcRnTypes.
+See also Note [Type variables in the type environment] in GHC.Tc.Utils.
Consider
data T where
@@ -3411,7 +3411,7 @@ Consider
Here
* The pattern (MkT p1 p2) creates a *skolem* type variable 'a_sk',
It must be a skolem so that that it retains its identity, and
- TcErrors.getSkolemInfo can thereby find the binding site for the skolem.
+ GHC.Tc.Errors.getSkolemInfo can thereby find the binding site for the skolem.
* The type signature pattern (f :: b -> c) makes freshs meta-tyvars
beta and gamma (TauTvs), and binds "b" :-> beta, "c" :-> gamma in the
@@ -3473,7 +3473,7 @@ It does sort checking and desugaring at the same time, in one single pass.
tcLHsKindSig :: UserTypeCtxt -> LHsKind GhcRn -> TcM Kind
tcLHsKindSig ctxt hs_kind
--- See Note [Recipe for checking a signature] in TcHsType
+-- See Note [Recipe for checking a signature] in GHC.Tc.Gen.HsType
-- Result is zonked
= do { kind <- solveLocalEqualities "tcLHsKindSig" $
tc_lhs_kind kindLevelMode hs_kind
diff --git a/compiler/typecheck/TcMatches.hs b/compiler/GHC/Tc/Gen/Match.hs
index a3f2649039..314b81faa8 100644
--- a/compiler/typecheck/TcMatches.hs
+++ b/compiler/GHC/Tc/Gen/Match.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-TcMatches: Typecheck some @Matches@
-}
{-# LANGUAGE CPP #-}
@@ -16,33 +14,47 @@ TcMatches: Typecheck some @Matches@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcMatches ( tcMatchesFun, tcGRHS, tcGRHSsPat, tcMatchesCase, tcMatchLambda,
- TcMatchCtxt(..), TcStmtChecker, TcExprStmtChecker, TcCmdStmtChecker,
- tcStmts, tcStmtsAndThen, tcDoStmts, tcBody,
- tcDoStmt, tcGuardStmt
- ) where
+-- | Typecheck some @Matches@
+module GHC.Tc.Gen.Match
+ ( tcMatchesFun
+ , tcGRHS
+ , tcGRHSsPat
+ , tcMatchesCase
+ , tcMatchLambda
+ , TcMatchCtxt(..)
+ , TcStmtChecker
+ , TcExprStmtChecker
+ , TcCmdStmtChecker
+ , tcStmts
+ , tcStmtsAndThen
+ , tcDoStmts
+ , tcBody
+ , tcDoStmt
+ , tcGuardStmt
+ )
+where
import GhcPrelude
-import {-# SOURCE #-} TcExpr( tcSyntaxOp, tcInferRhoNC, tcInferRho
- , tcCheckId, tcMonoExpr, tcMonoExprNC, tcPolyExpr )
+import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcSyntaxOp, tcInferRhoNC, tcInferRho
+ , tcCheckId, tcMonoExpr, tcMonoExprNC, tcPolyExpr )
import GHC.Types.Basic (LexicalFixity(..))
import GHC.Hs
-import TcRnMonad
-import TcEnv
-import TcPat
-import TcMType
-import TcType
-import TcBinds
-import TcUnify
-import TcOrigin
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.Pat
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Gen.Bind
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Types.Origin
import GHC.Types.Name
import TysWiredIn
import GHC.Types.Id
import GHC.Core.TyCon
import TysPrim
-import TcEvidence
+import GHC.Tc.Types.Evidence
import Outputable
import Util
import GHC.Types.SrcLoc
@@ -71,7 +83,7 @@ Note [Polymorphic expected type for tcMatchesFun]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcMatchesFun may be given a *sigma* (polymorphic) type
so it must be prepared to use tcSkolemise to skolemise it.
-See Note [sig_tau may be polymorphic] in TcPat.
+See Note [sig_tau may be polymorphic] in GHC.Tc.Gen.Pat.
-}
tcMatchesFun :: Located Name
@@ -128,7 +140,7 @@ tcMatchesCase :: (Outputable (body GhcRn)) =>
tcMatchesCase ctxt scrut_ty matches res_ty
= tcMatches ctxt [mkCheckExpType scrut_ty] res_ty matches
-tcMatchLambda :: SDoc -- see Note [Herald for matchExpectedFunTys] in TcUnify
+tcMatchLambda :: SDoc -- see Note [Herald for matchExpectedFunTys] in GHC.Tc.Utils.Unify
-> TcMatchCtxt HsExpr
-> MatchGroup GhcRn (LHsExpr GhcRn)
-> ExpRhoType -- deeply skolemised
@@ -924,7 +936,7 @@ tcDoStmt _ stmt _ _
-- The idea behind issuing MonadFail warnings is that we add them whenever a
-- failable pattern is encountered. However, instead of throwing a type error
-- when the constraint cannot be satisfied, we only issue a warning in
--- TcErrors.hs.
+-- GHC.Tc.Errors.hs.
tcMonadFailOp :: CtOrigin
-> LPat GhcTcId
diff --git a/compiler/typecheck/TcMatches.hs-boot b/compiler/GHC/Tc/Gen/Match.hs-boot
index ec3ada52a4..6b363511c8 100644
--- a/compiler/typecheck/TcMatches.hs-boot
+++ b/compiler/GHC/Tc/Gen/Match.hs-boot
@@ -1,9 +1,9 @@
-module TcMatches where
+module GHC.Tc.Gen.Match where
import GHC.Hs ( GRHSs, MatchGroup, LHsExpr )
-import TcEvidence ( HsWrapper )
+import GHC.Tc.Types.Evidence ( HsWrapper )
import GHC.Types.Name ( Name )
-import TcType ( ExpSigmaType, TcRhoType )
-import TcRnTypes ( TcM )
+import GHC.Tc.Utils.TcType( ExpSigmaType, TcRhoType )
+import GHC.Tc.Types ( TcM )
import GHC.Types.SrcLoc ( Located )
import GHC.Hs.Extension ( GhcRn, GhcTcId )
diff --git a/compiler/typecheck/TcPat.hs b/compiler/GHC/Tc/Gen/Pat.hs
index 0d3679eecd..0fa2b74c14 100644
--- a/compiler/typecheck/TcPat.hs
+++ b/compiler/GHC/Tc/Gen/Pat.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-TcPat: Typechecking patterns
-}
{-# LANGUAGE CPP, RankNTypes, TupleSections #-}
@@ -13,35 +11,45 @@ TcPat: Typechecking patterns
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcPat ( tcLetPat, newLetBndr, LetBndrSpec(..)
- , tcPat, tcPat_O, tcPats
- , addDataConStupidTheta, badFieldCon, polyPatSig ) where
+-- | Typechecking patterns
+module GHC.Tc.Gen.Pat
+ ( tcLetPat
+ , newLetBndr
+ , LetBndrSpec(..)
+ , tcPat
+ , tcPat_O
+ , tcPats
+ , addDataConStupidTheta
+ , badFieldCon
+ , polyPatSig
+ )
+where
#include "HsVersions.h"
import GhcPrelude
-import {-# SOURCE #-} TcExpr( tcSyntaxOp, tcSyntaxOpGen, tcInferSigma )
+import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcSyntaxOp, tcSyntaxOpGen, tcInferSigma )
import GHC.Hs
-import TcHsSyn
-import TcSigs( TcPragEnv, lookupPragEnv, addInlinePrags )
-import TcRnMonad
-import Inst
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Gen.Sig( TcPragEnv, lookupPragEnv, addInlinePrags )
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Instantiate
import GHC.Types.Id
import GHC.Types.Var
import GHC.Types.Name
import GHC.Types.Name.Reader
-import TcEnv
-import TcMType
-import TcValidity( arityErr )
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Validity( arityErr )
import GHC.Core.TyCo.Ppr ( pprTyVars )
-import TcType
-import TcUnify
-import TcHsType
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Gen.HsType
import TysWiredIn
-import TcEvidence
-import TcOrigin
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Origin
import GHC.Core.TyCon
import GHC.Core.DataCon
import GHC.Core.PatSyn
@@ -188,7 +196,7 @@ tcPatBndr penv@(PE { pe_ctxt = LetPat { pc_lvl = bind_lvl
, pc_new = no_gen } })
bndr_name exp_pat_ty
-- For the LetPat cases, see
- -- Note [Typechecking pattern bindings] in TcBinds
+ -- Note [Typechecking pattern bindings] in GHC.Tc.Gen.Bind
| Just bndr_id <- sig_fn bndr_name -- There is a signature
= do { wrap <- tcSubTypePat penv exp_pat_ty (idType bndr_id)
@@ -220,7 +228,7 @@ tcPatBndr _ bndr_name pat_ty
newLetBndr :: LetBndrSpec -> Name -> TcType -> TcM TcId
-- Make up a suitable Id for the pattern-binder.
--- See Note [Typechecking pattern bindings], item (4) in TcBinds
+-- See Note [Typechecking pattern bindings], item (4) in GHC.Tc.Gen.Bind
--
-- In the polymorphic case when we are going to generalise
-- (plan InferGen, no_gen = LetLclBndr), generate a "monomorphic version"
@@ -566,7 +574,7 @@ var_ty is the type inferred for x, the variable in the pattern.
If the pushed-down pattern type isn't a tau-type, the two pat_ty's above
could conceivably be different specializations. But this is very much
-like the situation in Note [Case branches must be taus] in TcMatches.
+like the situation in Note [Case branches must be taus] in GHC.Tc.Gen.Match.
So we tauify the pat_ty before proceeding.
Note that we need to type-check the literal twice, because it is used
@@ -1157,7 +1165,7 @@ Lazy patterns can't bind existentials. They arise in two ways:
The pe_lazy field of PatEnv says whether we are inside a lazy
pattern (perhaps deeply)
-See also Note [Typechecking pattern bindings] in TcBinds
+See also Note [Typechecking pattern bindings] in GHC.Tc.Gen.Bind
-}
maybeWrapPatCtxt :: Pat GhcRn -> (TcM a -> TcM b) -> TcM a -> TcM b
diff --git a/compiler/typecheck/TcRules.hs b/compiler/GHC/Tc/Gen/Rule.hs
index 3e32cda356..373dd42a83 100644
--- a/compiler/typecheck/TcRules.hs
+++ b/compiler/GHC/Tc/Gen/Rule.hs
@@ -2,31 +2,30 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1993-1998
-
-TcRules: Typechecking transformation rules
-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeFamilies #-}
-module TcRules ( tcRules ) where
+-- | Typechecking transformation rules
+module GHC.Tc.Gen.Rule ( tcRules ) where
import GhcPrelude
import GHC.Hs
-import TcRnTypes
-import TcRnMonad
-import TcSimplify
-import Constraint
+import GHC.Tc.Types
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Solver
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
-import TcMType
-import TcType
-import TcHsType
-import TcExpr
-import TcEnv
-import TcUnify( buildImplicationFor )
-import TcEvidence( mkTcCoVarCo )
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Gen.Expr
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Unify( buildImplicationFor )
+import GHC.Tc.Types.Evidence( mkTcCoVarCo )
import GHC.Core.Type
import GHC.Core.TyCon( isTypeFamilyTyCon )
import GHC.Types.Id
@@ -79,7 +78,7 @@ type variables (such as b0) at the /front/ of the telescope! This creates a
conflict.
One option is to simply throw an error, per the principles of
-Note [Naughty quantification candidates] in TcMType. This is what would happen
+Note [Naughty quantification candidates] in GHC.Tc.Utils.TcMType. This is what would happen
if we were generalising over a normal type signature. On the other hand, the
types in a rewrite rule aren't quite "normal", since the notions of specified
and inferred type variables aren't applicable.
@@ -94,7 +93,7 @@ variables `k` and `a`. But again, the notion of specificity is not relevant to
rewrite rules, since one cannot "visibly apply" a rewrite rule. This design not
only makes "foo" typecheck, but it also makes the implementation simpler.
-See also Note [Generalising in tcTyFamInstEqnGuts] in TcTyClsDecls, which
+See also Note [Generalising in tcTyFamInstEqnGuts] in GHC.Tc.TyCl, which
explains a very similar design when generalising over a type family instance
equation.
-}
@@ -138,7 +137,7 @@ tcRule (HsRule { rd_ext = ext
-- SimplfyRule Plan, step 4
-- Now figure out what to quantify over
- -- c.f. TcSimplify.simplifyInfer
+ -- c.f. GHC.Tc.Solver.simplifyInfer
-- We quantify over any tyvars free in *either* the rule
-- *or* the bound variables. The latter is important. Consider
-- ss (x,(y,z)) = (x,z)
@@ -147,7 +146,7 @@ tcRule (HsRule { rd_ext = ext
--
-- We also need to get the completely-unconstrained tyvars of
-- the LHS, lest they otherwise get defaulted to Any; but we do that
- -- during zonking (see TcHsSyn.zonkRule)
+ -- during zonking (see GHC.Tc.Utils.Zonk.zonkRule)
; let tpl_ids = lhs_evs ++ id_bndrs
@@ -233,7 +232,7 @@ tcRuleTmBndrs (L _ (RuleBndrSig _ (L _ name) rn_ty) : rule_bndrs)
= do { let ctxt = RuleSigCtxt name
; (_ , tvs, id_ty) <- tcHsPatSigType ctxt rn_ty
; let id = mkLocalId name id_ty
- -- See Note [Pattern signature binders] in TcHsType
+ -- See Note [Pattern signature binders] in GHC.Tc.Gen.HsType
-- The type variables scope over subsequent bindings; yuk
; (tyvars, tmvars) <- tcExtendNameTyVarEnv tvs $
@@ -448,13 +447,13 @@ getRuleQuantCts :: WantedConstraints -> (Cts, WantedConstraints)
--
-- NB: we must look inside implications, because with
-- -fdefer-type-errors we generate implications rather eagerly;
--- see TcUnify.implicationNeeded. Not doing so caused #14732.
+-- see GHC.Tc.Utils.Unify.implicationNeeded. Not doing so caused #14732.
--
-- Unlike simplifyInfer, we don't leave the WantedConstraints unchanged,
-- and attempt to solve them from the quantified constraints. That
-- nearly works, but fails for a constraint like (d :: Eq Int).
-- We /do/ want to quantify over it, but the short-cut solver
--- (see TcInteract Note [Shortcut solving]) ignores the quantified
+-- (see GHC.Tc.Solver.Interact Note [Shortcut solving]) ignores the quantified
-- and instead solves from the top level.
--
-- So we must partition the WantedConstraints ourselves
diff --git a/compiler/typecheck/TcSigs.hs b/compiler/GHC/Tc/Gen/Sig.hs
index 70b8bb2261..a6dfdcc2f4 100644
--- a/compiler/typecheck/TcSigs.hs
+++ b/compiler/GHC/Tc/Gen/Sig.hs
@@ -7,7 +7,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeFamilies #-}
-module TcSigs(
+module GHC.Tc.Gen.Sig(
TcSigInfo(..),
TcIdSigInfo(..), TcIdSigInst,
TcPatSynInfo(..),
@@ -28,17 +28,17 @@ module TcSigs(
import GhcPrelude
import GHC.Hs
-import TcHsType
-import TcRnTypes
-import TcRnMonad
-import TcOrigin
-import TcType
-import TcMType
-import TcValidity ( checkValidType )
-import TcUnify( tcSkolemise, unifyType )
-import Inst( topInstantiate )
-import TcEnv( tcLookupId )
-import TcEvidence( HsWrapper, (<.>) )
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Types
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Validity ( checkValidType )
+import GHC.Tc.Utils.Unify( tcSkolemise, unifyType )
+import GHC.Tc.Utils.Instantiate( topInstantiate )
+import GHC.Tc.Utils.Env( tcLookupId )
+import GHC.Tc.Types.Evidence( HsWrapper, (<.>) )
import GHC.Core.Type ( mkTyVarBinders )
import GHC.Driver.Session
@@ -88,7 +88,7 @@ especially on value bindings. Here's an overview.
In tcMonoBinds, when looking at an individual binding, we use
tcInstSig to instantiate the signature forall's in the signature,
and attribute that instantiated (monomorphic) type to the
- binder. You can see this in TcBinds.tcLhsId.
+ binder. You can see this in GHC.Tc.Gen.Bind.tcLhsId.
The instantiation does the obvious thing for complete signatures,
but for /partial/ signatures it starts from the HsSyn, so it
@@ -315,7 +315,7 @@ If a type signature is wrong, fail immediately:
ToDo: this means we fall over if any top-level type signature in the
module is wrong, because we typecheck all the signatures together
-(see TcBinds.tcValBinds). Moreover, because of top-level
+(see GHC.Tc.Gen.Bind.tcValBinds). Moreover, because of top-level
captureTopConstraints, only insoluble constraints will be reported.
We typecheck all signatures at the same time because a signature
like f,g :: blah might have f and g from different SCCs.
@@ -356,7 +356,7 @@ Note [solveEqualities in tcPatSynSig]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's important that we solve /all/ the equalities in a pattern
synonym signature, because we are going to zonk the signature to
-a Type (not a TcType), in TcPatSyn.tc_patsyn_finish, and that
+a Type (not a TcType), in GHC.Tc.TyCl.PatSyn.tc_patsyn_finish, and that
fails if there are un-filled-in coercion variables mentioned
in the type (#15694).
@@ -373,7 +373,7 @@ and fail, as it should.)
tcPatSynSig :: Name -> LHsSigType GhcRn -> TcM TcPatSynInfo
-- See Note [Pattern synonym signatures]
--- See Note [Recipe for checking a signature] in TcHsType
+-- See Note [Recipe for checking a signature] in GHC.Tc.Gen.HsType
tcPatSynSig name sig_ty
| HsIB { hsib_ext = implicit_hs_tvs
, hsib_body = hs_ty } <- sig_ty
@@ -411,7 +411,7 @@ tcPatSynSig name sig_ty
; body_ty <- zonkTcType body_ty
-- Skolems have TcLevels too, though they're used only for debugging.
- -- If you don't do this, the debugging checks fail in TcPatSyn.
+ -- If you don't do this, the debugging checks fail in GHC.Tc.TyCl.PatSyn.
-- Test case: patsyn/should_compile/T13441
{-
; tclvl <- getTcLevel
@@ -499,7 +499,7 @@ tcInstSig hs_sig@(PartialSig { psig_hs_ty = hs_ty
= setSrcSpan loc $ -- Set the binding site of the tyvars
do { traceTc "Staring partial sig {" (ppr hs_sig)
; (wcs, wcx, tv_prs, theta, tau) <- tcHsPartialSigType ctxt hs_ty
- -- See Note [Checking partial type signatures] in TcHsType
+ -- See Note [Checking partial type signatures] in GHC.Tc.Gen.HsType
; let inst_sig = TISI { sig_inst_sig = hs_sig
, sig_inst_skols = tv_prs
, sig_inst_wcs = wcs
@@ -523,12 +523,12 @@ the signature types for f and g, we'll end up unifying 'a' and 'b'
So we instantiate f and g's signature with TyVarTv skolems
(newMetaTyVarTyVars) that can unify with each other. If too much
unification takes place, we'll find out when we do the final
-impedance-matching check in TcBinds.mkExport
+impedance-matching check in GHC.Tc.Gen.Bind.mkExport
-See Note [Signature skolems] in TcType
+See Note [Signature skolems] in GHC.Tc.Utils.TcType
None of this applies to a function binding with a complete
-signature, which doesn't use tcInstSig. See TcBinds.tcPolyCheck.
+signature, which doesn't use tcInstSig. See GHC.Tc.Gen.Bind.tcPolyCheck.
-}
{- *********************************************************************
@@ -720,7 +720,7 @@ Some wrinkles
forall ab. (Eq a, Ix b) => XXX
regardless of XXX. It's sort of polymorphic in XXX. This is
useful: we use the same wrapper to transform each of the class ops, as
- well as the dict. That's what goes on in TcInstDcls.mk_meth_spec_prags
+ well as the dict. That's what goes on in GHC.Tc.TyCl.Instance.mk_meth_spec_prags
-}
tcSpecPrags :: Id -> [LSig GhcRn]
diff --git a/compiler/typecheck/TcSplice.hs b/compiler/GHC/Tc/Gen/Splice.hs
index df32401bc7..3de1e2063d 100644
--- a/compiler/typecheck/TcSplice.hs
+++ b/compiler/GHC/Tc/Gen/Splice.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-TcSplice: Template Haskell splices
-}
{-# LANGUAGE CPP #-}
@@ -21,7 +19,8 @@ TcSplice: Template Haskell splices
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcSplice(
+-- | Template Haskell splices
+module GHC.Tc.Gen.Splice(
tcSpliceExpr, tcTypedBracket, tcUntypedBracket,
-- runQuasiQuoteExpr, runQuasiQuotePat,
-- runQuasiQuoteDecl, runQuasiQuoteType,
@@ -41,16 +40,16 @@ import GHC.Hs
import GHC.Types.Annotations
import GHC.Driver.Finder
import GHC.Types.Name
-import TcRnMonad
-import TcType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
import Outputable
-import TcExpr
+import GHC.Tc.Gen.Expr
import GHC.Types.SrcLoc
import THNames
-import TcUnify
-import TcEnv
-import TcOrigin
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Utils.Env
+import GHC.Tc.Types.Origin
import GHC.Core.Coercion( etaExpandCoAxBranch )
import FileCleanup ( newTempName, TempFileLifetime(..) )
@@ -61,7 +60,7 @@ import GHCi.RemoteTypes
import GHC.Runtime.Interpreter
import GHC.Runtime.Interpreter.Types
import GHC.Driver.Main
- -- These imports are the reason that TcSplice
+ -- 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
@@ -71,19 +70,19 @@ import GHC.Rename.Expr
import GHC.Rename.Env
import GHC.Rename.Utils ( HsDocContext(..) )
import GHC.Rename.Fixity ( lookupFixityRn_help )
-import GHC.Rename.Types
-import TcHsSyn
-import TcSimplify
+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 TcMType
-import TcHsType
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Gen.HsType
import GHC.IfaceToCore
import GHC.Core.TyCo.Rep as TyCoRep
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import GHC.Core.InstEnv as InstEnv
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.Types.Name.Env
import PrelNames
import TysWiredIn
@@ -98,7 +97,7 @@ import GHC.Core.Coercion.Axiom
import GHC.Core.PatSyn
import GHC.Core.ConLike
import GHC.Core.DataCon as DataCon
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.HsToCore.Expr
@@ -589,7 +588,7 @@ tcSpliceExpr splice@(HsTypedSplice _ _ name expr) res_ty
Splice {} -> tcTopSplice expr res_ty
Brack pop_stage pend -> tcNestedSplice pop_stage pend name expr res_ty
RunSplice _ ->
- -- See Note [RunSplice ThLevel] in "TcRnTypes".
+ -- See Note [RunSplice ThLevel] in "GHC.Tc.Types".
pprPanic ("tcSpliceExpr: attempted to typecheck a splice when " ++
"running another splice") (ppr splice)
Comp -> tcTopSplice expr res_ty
@@ -1013,7 +1012,7 @@ context and are unified correctly.
This is implemented by storing the arguments we need for running the splice
in a `DelayedSplice`. In the zonker, the arguments are passed to
-`TcSplice.runTopSplice` and the expression inserted into the AST as normal.
+`GHC.Tc.Gen.Splice.runTopSplice` and the expression inserted into the AST as normal.
@@ -1036,7 +1035,7 @@ like that. Here's how it's processed:
where 'qReport' comes from the Quasi class and fail from its monad
superclass.
- * The TcM monad is an instance of Quasi (see TcSplice), and it implements
+ * The TcM monad is an instance of Quasi (see GHC.Tc.Gen.Splice), and it implements
(qReport True s) by using addErr to add an error message to the bag of errors.
The 'fail' in TcM raises an IOEnvFailure exception
@@ -1541,7 +1540,7 @@ lookupThName_maybe th_name
Nothing -> lookupGlobalOccRn_maybe rdr_name }
tcLookupTh :: Name -> TcM TcTyThing
--- This is a specialised version of TcEnv.tcLookup; specialised mainly in that
+-- This is a specialised version of GHC.Tc.Utils.Env.tcLookup; specialised mainly in that
-- it gives a reify-related error message on failure, whereas in the normal
-- tcLookup, failure is a bug.
tcLookupTh name
@@ -1767,7 +1766,7 @@ reifyDataCon isGadtDataCon tys dc
dcdBangs r_arg_tys) res_ty }
-- We need to check not isGadtDataCon here because GADT
-- constructors can be declared infix.
- -- See Note [Infix GADT constructors] in TcTyClsDecls.
+ -- See Note [Infix GADT constructors] in GHC.Tc.TyCl.
| dataConIsInfix dc && not isGadtDataCon ->
ASSERT( r_arg_tys `lengthIs` 2 ) do
{ let [r_a1, r_a2] = r_arg_tys
diff --git a/compiler/typecheck/TcSplice.hs-boot b/compiler/GHC/Tc/Gen/Splice.hs-boot
index f6d57a7552..d74edf3f3a 100644
--- a/compiler/typecheck/TcSplice.hs-boot
+++ b/compiler/GHC/Tc/Gen/Splice.hs-boot
@@ -1,15 +1,15 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeFamilies #-}
-module TcSplice where
+module GHC.Tc.Gen.Splice where
import GhcPrelude
import GHC.Types.Name
import GHC.Hs.Expr ( PendingRnSplice, DelayedSplice )
-import TcRnTypes( TcM , SpliceType )
-import TcType ( ExpRhoType )
+import GHC.Tc.Types( TcM , SpliceType )
+import GHC.Tc.Utils.TcType ( ExpRhoType )
import GHC.Types.Annotations ( Annotation, CoreAnnTarget )
-import GHC.Hs.Extension ( GhcTcId, GhcRn, GhcPs, GhcTc )
+import GHC.Hs.Extension ( GhcTcId, GhcRn, GhcPs, GhcTc )
import GHC.Hs ( HsSplice, HsBracket, HsExpr, LHsExpr, LHsType, LPat,
LHsDecl, ThModFinalizers )
diff --git a/compiler/typecheck/ClsInst.hs b/compiler/GHC/Tc/Instance/Class.hs
index 3c33c59180..81ee5aec71 100644
--- a/compiler/typecheck/ClsInst.hs
+++ b/compiler/GHC/Tc/Instance/Class.hs
@@ -2,7 +2,7 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module ClsInst (
+module GHC.Tc.Instance.Class (
matchGlobalInst,
ClsInstResult(..),
InstanceWhat(..), safeOverlap, instanceReturnsDictCon,
@@ -13,18 +13,18 @@ module ClsInst (
import GhcPrelude
-import TcEnv
-import TcRnMonad
-import TcType
-import TcTypeable
-import TcMType
-import TcEvidence
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
+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 Inst( instDFunType )
-import FamInst( tcGetFamInstEnvs, tcInstNewTyCon_maybe, tcLookupDataFamInst )
+import GHC.Tc.Utils.Instantiate( instDFunType )
+import GHC.Tc.Instance.Family( tcGetFamInstEnvs, tcInstNewTyCon_maybe, tcLookupDataFamInst )
import TysWiredIn
import TysPrim( eqPrimTyCon, eqReprPrimTyCon )
@@ -60,7 +60,7 @@ data AssocInstInfo
| InClsInst { ai_class :: Class
, ai_tyvars :: [TyVar] -- ^ The /scoped/ tyvars of the instance
-- Why scoped? See bind_me in
- -- TcValidity.checkConsistentFamInst
+ -- GHC.Tc.Validity.checkConsistentFamInst
, ai_inst_env :: VarEnv Type -- ^ Maps /class/ tyvars to their instance types
-- See Note [Matching in the consistent-instantiation check]
}
@@ -79,8 +79,8 @@ isNotAssociated (InClsInst {}) = False
-- | Indicates if Instance met the Safe Haskell overlapping instances safety
-- check.
--
--- See Note [Safe Haskell Overlapping Instances] in TcSimplify
--- See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
+-- See Note [Safe Haskell Overlapping Instances] in GHC.Tc.Solver
+-- See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
type SafeOverlapping = Bool
data ClsInstResult
@@ -95,7 +95,7 @@ data ClsInstResult
data InstanceWhat
= BuiltinInstance
| BuiltinEqInstance -- A built-in "equality instance"; see the
- -- TcSMonad Note [Solved dictionaries]
+ -- GHC.Tc.Solver.Monad Note [Solved dictionaries]
| LocalInstance
| TopLevInstance { iw_dfun_id :: DFunId
, iw_safe_over :: SafeOverlapping }
@@ -120,7 +120,7 @@ safeOverlap (TopLevInstance { iw_safe_over = so }) = so
safeOverlap _ = True
instanceReturnsDictCon :: InstanceWhat -> Bool
--- See Note [Solved dictionaries] in TcSMonad
+-- See Note [Solved dictionaries] in GHC.Tc.Solver.Monad
instanceReturnsDictCon (TopLevInstance {}) = True
instanceReturnsDictCon BuiltinInstance = True
instanceReturnsDictCon BuiltinEqInstance = False
@@ -274,7 +274,7 @@ Conceptually, this class has infinitely many instances:
...
In practice, we solve `KnownNat` predicates in the type-checker
-(see typecheck/TcInteract.hs) because we can't have infinitely many instances.
+(see GHC.Tc.Solver.Interact) because we can't have infinitely many instances.
The evidence (aka "dictionary") for `KnownNat` is of the form `EvLit (EvNum n)`.
We make the following assumptions about dictionaries in GHC:
@@ -376,7 +376,7 @@ matchKnownSymbol df sc clas tys = matchInstEnv df sc clas tys
makeLitDict :: Class -> Type -> EvExpr -> TcM ClsInstResult
-- makeLitDict adds a coercion that will convert the literal into a dictionary
-- of the appropriate type. See Note [KnownNat & KnownSymbol and EvLit]
--- in TcEvidence. The coercion happens in 2 steps:
+-- in GHC.Tc.Types.Evidence. The coercion happens in 2 steps:
--
-- Integer -> SNat n -- representation of literal to singleton
-- SNat n -> KnownNat n -- singleton to dictionary
@@ -439,7 +439,7 @@ doFunTy clas ty arg_ty ret_ty
preds = map (mk_typeable_pred clas) [arg_ty, ret_ty]
mk_ev [arg_ev, ret_ev] = evTypeable ty $
EvTypeableTrFun (EvExpr arg_ev) (EvExpr ret_ev)
- mk_ev _ = panic "TcInteract.doFunTy"
+ mk_ev _ = panic "GHC.Tc.Solver.Interact.doFunTy"
-- | Representation for type constructor applied to some kinds.
diff --git a/compiler/typecheck/FamInst.hs b/compiler/GHC/Tc/Instance/Family.hs
index 1e983d0e24..68c894f2e4 100644
--- a/compiler/typecheck/FamInst.hs
+++ b/compiler/GHC/Tc/Instance/Family.hs
@@ -1,8 +1,7 @@
--- The @FamInst@ type: family instance heads
-
{-# LANGUAGE CPP, GADTs, ViewPatterns #-}
-module FamInst (
+-- | The @FamInst@ type: family instance heads
+module GHC.Tc.Instance.Family (
FamInstEnvs, tcGetFamInstEnvs,
checkFamInstConsistency, tcExtendLocalFamInstEnv,
tcLookupDataFamInst, tcLookupDataFamInst_maybe,
@@ -20,12 +19,12 @@ import GHC.Core.FamInstEnv
import GHC.Core.InstEnv( roughMatchTcs )
import GHC.Core.Coercion
import GHC.Core.Lint
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Iface.Load
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.SrcLoc as SrcLoc
import GHC.Core.TyCon
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Coercion.Axiom
import GHC.Driver.Session
import GHC.Types.Module
@@ -37,7 +36,7 @@ import Maybes
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.FVs
import GHC.Core.TyCo.Ppr ( pprWithExplicitKindsWhen )
-import TcMType
+import GHC.Tc.Utils.TcMType
import GHC.Types.Name
import Panic
import GHC.Types.Var.Set
@@ -176,7 +175,7 @@ newFamInst flavor axiom@(CoAxiom { co_ax_tc = fam_tc })
tcvs' = tvs' ++ cvs'
; ifErrsM (return ()) $ -- Don't lint when there are errors, because
-- errors might mean TcTyCons.
- -- See Note [Recover from validity error] in TcTyClsDecls
+ -- See Note [Recover from validity error] in GHC.Tc.TyCl
when (gopt Opt_DoCoreLinting dflags) $
-- Check that the types involved in this instance are well formed.
-- Do /not/ expand type synonyms, for the reasons discussed in
diff --git a/compiler/typecheck/FunDeps.hs b/compiler/GHC/Tc/Instance/FunDeps.hs
index 42c06183f7..73a1317692 100644
--- a/compiler/typecheck/FunDeps.hs
+++ b/compiler/GHC/Tc/Instance/FunDeps.hs
@@ -3,19 +3,23 @@
(c) The GRASP/AQUA Project, Glasgow University, 2000
-FunDeps - functional dependencies
-
-It's better to read it as: "if we know these, then we're going to know these"
-}
{-# LANGUAGE CPP #-}
-module FunDeps (
- FunDepEqn(..), pprEquation,
- improveFromInstEnv, improveFromAnother,
- checkInstCoverage, checkFunDeps,
- pprFundeps
- ) where
+-- | Functional dependencies
+--
+-- It's better to read it as: "if we know these, then we're going to know these"
+module GHC.Tc.Instance.FunDeps
+ ( FunDepEqn(..)
+ , pprEquation
+ , improveFromInstEnv
+ , improveFromAnother
+ , checkInstCoverage
+ , checkFunDeps
+ , pprFundeps
+ )
+where
#include "HsVersions.h"
@@ -26,7 +30,7 @@ import GHC.Types.Var
import GHC.Core.Class
import GHC.Core.Predicate
import GHC.Core.Type
-import TcType( transSuperClasses )
+import GHC.Tc.Utils.TcType( transSuperClasses )
import GHC.Core.Coercion.Axiom( TypeEqn )
import GHC.Core.Unify
import GHC.Core.InstEnv
diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/GHC/Tc/Instance/Typeable.hs
index 4de6e7a6d7..842157a3d4 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/GHC/Tc/Instance/Typeable.hs
@@ -8,7 +8,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
-module TcTypeable(mkTypeableBinds, tyConIsTypeable) where
+module GHC.Tc.Instance.Typeable(mkTypeableBinds, tyConIsTypeable) where
#include "HsVersions.h"
@@ -18,10 +18,10 @@ import GHC.Platform
import GHC.Types.Basic ( Boxity(..), neverInlinePragma, SourceText(..) )
import GHC.Iface.Env( newGlobalBinder )
import GHC.Core.TyCo.Rep( Type(..), TyLit(..) )
-import TcEnv
-import TcEvidence ( mkWpTyApps )
-import TcRnMonad
-import TcType
+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 PrelNames
import TysPrim ( primTyCons )
@@ -54,7 +54,7 @@ import Data.Word( Word64 )
The overall plan is this:
1. Generate a binding for each module p:M
- (done in TcTypeable by mkModIdBindings)
+ (done in GHC.Tc.Instance.Typeable by mkModIdBindings)
M.$trModule :: GHC.Types.Module
M.$trModule = Module "p" "M"
("tr" is short for "type representation"; see GHC.Types)
@@ -94,7 +94,7 @@ The overall plan is this:
interface file to find its type, value, etc
4. Solve Typeable constraints. This is done by a custom Typeable solver,
- currently in TcInteract, that use M.$tcT so solve (Typeable T).
+ currently in GHC.Tc.Solver.Interact, that use M.$tcT so solve (Typeable T).
There are many wrinkles:
@@ -105,7 +105,7 @@ There are many wrinkles:
* GHC.Prim doesn't have any associated object code, so we need to put the
representations for types defined in this module elsewhere. We chose this
- place to be GHC.Types. TcTypeable.mkPrimTypeableBinds is responsible for
+ place to be GHC.Types. GHC.Tc.Instance.Typeable.mkPrimTypeableBinds is responsible for
injecting the bindings for the GHC.Prim representions when compiling
GHC.Types.
@@ -146,7 +146,7 @@ There are many wrinkles:
-- entry-point of this module and is invoked by the typechecker driver in
-- 'tcRnSrcDecls'.
--
--- See Note [Grand plan for Typeable] in TcTypeable.
+-- See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.
mkTypeableBinds :: TcM TcGblEnv
mkTypeableBinds
= do { dflags <- getDynFlags
diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/GHC/Tc/Module.hs
index 91ac66b972..54b663f581 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -2,9 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcRnDriver]{Typechecking a whole module}
-
-https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/type-checker
-}
{-# LANGUAGE CPP #-}
@@ -19,7 +16,10 @@ https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/type-checker
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcRnDriver (
+-- | Typechecking a whole module
+--
+-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/type-checker
+module GHC.Tc.Module (
tcRnStmt, tcRnExpr, TcRnExprMode(..), tcRnType,
tcRnImportDecls,
tcRnLookupRdrName,
@@ -50,15 +50,15 @@ module TcRnDriver (
import GhcPrelude
-import {-# SOURCE #-} TcSplice ( finishTH, runRemoteModFinalizers )
+import {-# SOURCE #-} GHC.Tc.Gen.Splice ( finishTH, runRemoteModFinalizers )
import GHC.Rename.Splice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) )
import GHC.Iface.Env ( externaliseName )
-import TcHsType
-import TcValidity( checkValidType )
-import TcMatches
-import Inst( deeplyInstantiate )
-import TcUnify( checkConstraints )
-import GHC.Rename.Types
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Validity( checkValidType )
+import GHC.Tc.Gen.Match
+import GHC.Tc.Utils.Instantiate( deeplyInstantiate )
+import GHC.Tc.Utils.Unify( checkConstraints )
+import GHC.Rename.HsType
import GHC.Rename.Expr
import GHC.Rename.Utils ( HsDocContext(..) )
import GHC.Rename.Fixity ( lookupFixityRn )
@@ -72,41 +72,41 @@ import GHC.Core.PatSyn( pprPatSynType )
import PrelNames
import PrelInfo
import GHC.Types.Name.Reader
-import TcHsSyn
-import TcExpr
-import TcRnMonad
-import TcRnExports
-import TcEvidence
-import Constraint
-import TcOrigin
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Gen.Expr
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Gen.Export
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Origin
import qualified BooleanFormula as BF
import GHC.Core.Ppr.TyThing ( pprTyThingInContext )
import GHC.Core.FVs ( orphNamesOfFamInst )
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
( FamInst, pprFamInst, famInstsRepTyCons
, famInstEnvElts, extendFamInstEnvList, normaliseType )
-import TcAnnotations
-import TcBinds
+import GHC.Tc.Gen.Annotation
+import GHC.Tc.Gen.Bind
import GHC.Iface.Make ( coAxiomToIfaceDecl )
import HeaderInfo ( mkPrelImports )
-import TcDefaults
-import TcEnv
-import TcRules
-import TcForeign
-import TcInstDcls
+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 TcMType
-import TcType
-import TcSimplify
-import TcTyClsDecls
-import TcTypeable ( mkTypeableBinds )
-import TcBackpack
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.TcType
+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.Names
import GHC.Rename.Env
-import GHC.Rename.Source
+import GHC.Rename.Module
import ErrUtils
import GHC.Types.Id as Id
import GHC.Types.Id.Info( IdDetails(..) )
@@ -135,7 +135,7 @@ import FastString
import Maybes
import Util
import Bag
-import Inst (tcGetInsts)
+import GHC.Tc.Utils.Instantiate (tcGetInsts)
import qualified GHC.LanguageExtensions as LangExt
import Data.Data ( Data )
import GHC.Hs.Dump
@@ -144,7 +144,7 @@ import qualified Data.Set as S
import Control.DeepSeq
import Control.Monad
-import TcHoleFitTypes ( HoleFitPluginR (..) )
+import GHC.Tc.Errors.Hole.FitTypes ( HoleFitPluginR (..) )
#include "HsVersions.h"
@@ -280,7 +280,7 @@ tcRnModuleTcRnM hsc_env mod_sum
tcg_env <- checkHiBootIface tcg_env boot_info
; -- The new type env is already available to stuff
-- slurped from interface files, via
- -- TcEnv.setGlobalTypeEnv. It's important that this
+ -- GHC.Tc.Utils.Env.setGlobalTypeEnv. It's important that this
-- includes the stuff in checkHiBootIface,
-- because the latter might add new bindings for
-- boot_dfuns, which may be mentioned in imported
@@ -632,7 +632,7 @@ tcRnHsBootDecls hsc_src decls
<- rnTopSrcDecls first_group
-- The empty list is for extra dependencies coming from .hs-boot files
- -- See Note [Extra dependencies from .hs-boot files] in GHC.Rename.Source
+ -- See Note [Extra dependencies from .hs-boot files] in GHC.Rename.Module
; (gbl_env, lie) <- setGblEnv tcg_env $ captureTopConstraints $ do {
-- NB: setGblEnv **before** captureTopConstraints so that
@@ -794,7 +794,7 @@ checkHiBootIface'
-- Check for no family instances
; unless (null boot_fam_insts) $
- panic ("TcRnDriver.checkHiBootIface: Cannot handle family " ++
+ panic ("GHC.Tc.Module.checkHiBootIface: Cannot handle family " ++
"instances in boot files yet...")
-- FIXME: Why? The actual comparison is not hard, but what would
-- be the equivalent to the dfun bindings returned for class
@@ -2391,7 +2391,7 @@ tcGhciStmts stmts
names = collectLStmtsBinders stmts
-- OK, we're ready to typecheck the stmts
- ; traceTc "TcRnDriver.tcGhciStmts: tc stmts" empty
+ ; traceTc "GHC.Tc.Module.tcGhciStmts: tc stmts" empty
; ((tc_stmts, ids), lie) <- captureTopConstraints $
tc_io_stmts $ \ _ ->
mapM tcLookupId names
@@ -2399,12 +2399,12 @@ tcGhciStmts stmts
-- where they will all be in scope
-- Simplify the context
- ; traceTc "TcRnDriver.tcGhciStmts: simplify ctxt" empty
+ ; traceTc "GHC.Tc.Module.tcGhciStmts: simplify ctxt" empty
; const_binds <- checkNoErrs (simplifyInteractive lie)
-- checkNoErrs ensures that the plan fails if context redn fails
- ; traceTc "TcRnDriver.tcGhciStmts: done" empty
+ ; traceTc "GHC.Tc.Module.tcGhciStmts: done" empty
-- rec_expr is the expression
-- returnIO @ [()] [unsafeCoerce# () x, .., unsafeCorece# () z]
@@ -2518,7 +2518,7 @@ tcRnExpr hsc_env mode rdr_expr
ty <- zonkTcType all_expr_ty ;
-- We normalise type families, so that the type of an expression is the
- -- same as of a bound expression (TcBinds.mkInferredPolyId). See Trac
+ -- same as of a bound expression (GHC.Tc.Gen.Bind.mkInferredPolyId). See Trac
-- #10321 for further discussion.
fam_envs <- tcGetFamInstEnvs ;
-- normaliseType returns a coercion which we discard, so the Role is
@@ -2561,7 +2561,7 @@ tcRnType hsc_env flexi normalise rdr_type
-- generalisation; e.g. :kind (T _)
; failIfErrsM
- -- We follow Note [Recipe for checking a signature] in TcHsType here
+ -- We follow Note [Recipe for checking a signature] in GHC.Tc.Gen.HsType here
-- Now kind-check the type
-- It can have any rank or kind
@@ -3010,7 +3010,7 @@ withTcPlugins hsc_env m =
do s <- runTcPluginM start ev_binds_var
return (solve s, stop s)
-getTcPlugins :: DynFlags -> [TcRnMonad.TcPlugin]
+getTcPlugins :: DynFlags -> [GHC.Tc.Utils.Monad.TcPlugin]
getTcPlugins dflags = catMaybes $ mapPlugins dflags (\p args -> tcPlugin p args)
diff --git a/compiler/typecheck/TcRnDriver.hs-boot b/compiler/GHC/Tc/Module.hs-boot
index a867236c74..f1f5e31e8a 100644
--- a/compiler/typecheck/TcRnDriver.hs-boot
+++ b/compiler/GHC/Tc/Module.hs-boot
@@ -1,8 +1,8 @@
-module TcRnDriver where
+module GHC.Tc.Module where
import GhcPrelude
import GHC.Core.Type(TyThing)
-import TcRnTypes (TcM)
+import GHC.Tc.Types (TcM)
import Outputable (SDoc)
import GHC.Types.Name (Name)
diff --git a/compiler/typecheck/TcPluginM.hs b/compiler/GHC/Tc/Plugin.hs
index 339a13dca2..cde159815f 100644
--- a/compiler/typecheck/TcPluginM.hs
+++ b/compiler/GHC/Tc/Plugin.hs
@@ -2,7 +2,7 @@
-- | This module provides an interface for typechecker plugins to
-- access select functions of the 'TcM', principally those to do with
-- reading parts of the state.
-module TcPluginM (
+module GHC.Tc.Plugin (
-- * Basic TcPluginM functionality
TcPluginM,
tcPluginIO,
@@ -52,24 +52,24 @@ module TcPluginM (
import GhcPrelude
-import qualified TcRnMonad as TcM
-import qualified TcSMonad as TcS
-import qualified TcEnv as TcM
-import qualified TcMType as TcM
-import qualified FamInst as TcM
-import qualified GHC.Iface.Env as IfaceEnv
-import qualified GHC.Driver.Finder as Finder
-
-import GHC.Core.FamInstEnv ( FamInstEnv )
-import TcRnMonad ( TcGblEnv, TcLclEnv, TcPluginM
- , unsafeTcPluginTcM, getEvBindsTcPluginM
- , liftIO, traceTc )
-import Constraint ( Ct, CtLoc, CtEvidence(..), ctLocOrigin )
-import TcMType ( TcTyVar, TcType )
-import TcEnv ( TcTyThing )
-import TcEvidence ( TcCoercion, CoercionHole, EvTerm(..)
- , EvExpr, EvBind, mkGivenEvBind )
-import GHC.Types.Var ( EvVar )
+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.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 GHC.Core.FamInstEnv ( FamInstEnv )
+import GHC.Tc.Utils.Monad ( TcGblEnv, TcLclEnv, TcPluginM
+ , unsafeTcPluginTcM, getEvBindsTcPluginM
+ , liftIO, traceTc )
+import GHC.Tc.Types.Constraint ( Ct, CtLoc, CtEvidence(..), ctLocOrigin )
+import GHC.Tc.Utils.TcMType ( TcTyVar, TcType )
+import GHC.Tc.Utils.Env ( TcTyThing )
+import GHC.Tc.Types.Evidence ( TcCoercion, CoercionHole, EvTerm(..)
+ , EvExpr, EvBind, mkGivenEvBind )
+import GHC.Types.Var ( EvVar )
import GHC.Types.Module
import GHC.Types.Name
@@ -148,7 +148,7 @@ newFlexiTyVar = unsafeTcPluginTcM . TcM.newFlexiTyVar
isTouchableTcPluginM :: TcTyVar -> TcPluginM Bool
isTouchableTcPluginM = unsafeTcPluginTcM . TcM.isTouchableTcM
--- Confused by zonking? See Note [What is zonking?] in TcMType.
+-- Confused by zonking? See Note [What is zonking?] in GHC.Tc.Utils.TcMType.
zonkTcType :: TcType -> TcPluginM TcType
zonkTcType = unsafeTcPluginTcM . TcM.zonkTcType
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/GHC/Tc/Solver.hs
index 1ac4c74921..ad2c7816d2 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/GHC/Tc/Solver.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}
-module TcSimplify(
+module GHC.Tc.Solver(
simplifyInfer, InferMode(..),
growThetaTyVars,
simplifyAmbiguityCheck,
@@ -32,23 +32,23 @@ import Bag
import GHC.Core.Class ( Class, classKey, classTyCon )
import GHC.Driver.Session
import GHC.Types.Id ( idType, mkLocalId )
-import Inst
+import GHC.Tc.Utils.Instantiate
import ListSetOps
import GHC.Types.Name
import Outputable
import PrelInfo
import PrelNames
-import TcErrors
-import TcEvidence
-import TcInteract
-import TcCanonical ( makeSuperClasses, solveCallStack )
-import TcMType as TcM
-import TcRnMonad as TcM
-import TcSMonad as TcS
-import Constraint
+import GHC.Tc.Errors
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Solver.Interact
+import GHC.Tc.Solver.Canonical ( makeSuperClasses, solveCallStack )
+import GHC.Tc.Utils.TcMType as TcM
+import GHC.Tc.Utils.Monad as TcM
+import GHC.Tc.Solver.Monad as TcS
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
-import TcType
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import TysWiredIn ( liftedRepTy )
import GHC.Core.Unify ( tcMatchTyKi )
@@ -80,7 +80,7 @@ captureTopConstraints :: TcM a -> TcM (a, WantedConstraints)
-- If it fails with an exception, it reports any insolubles
-- (out of scope variables) before doing so
--
--- captureTopConstraints is used exclusively by TcRnDriver at the top
+-- captureTopConstraints is used exclusively by GHC.Tc.Module at the top
-- level of a module.
--
-- Importantly, if captureTopConstraints propagates an exception, it
@@ -88,7 +88,7 @@ captureTopConstraints :: TcM a -> TcM (a, WantedConstraints)
-- altogether. This is important, because solveLocalEqualities (maybe
-- other things too) throws an exception without adding any error
-- messages; it just puts the unsolved constraints back into the
--- monad. See TcRnMonad Note [Constraints and errors]
+-- monad. See GHC.Tc.Utils.Monad Note [Constraints and errors]
-- #16376 is an example of what goes wrong if you don't do this.
--
-- NB: the caller should bring any environments into scope before
@@ -100,7 +100,7 @@ captureTopConstraints thing_inside
TcM.tryCaptureConstraints thing_inside
; stWC <- TcM.readTcRef static_wc_var
- -- See TcRnMonad Note [Constraints and errors]
+ -- See GHC.Tc.Utils.Monad Note [Constraints and errors]
-- If the thing_inside threw an exception, but generated some insoluble
-- constraints, report the latter before propagating the exception
-- Otherwise they will be lost altogether
@@ -108,7 +108,7 @@ captureTopConstraints thing_inside
Just res -> return (res, lie `andWC` stWC)
Nothing -> do { _ <- simplifyTop lie; failM } }
-- This call to simplifyTop is the reason
- -- this function is here instead of TcRnMonad
+ -- this function is here instead of GHC.Tc.Utils.Monad
-- We call simplifyTop so that it does defaulting
-- (esp of runtime-reps) before reporting errors
@@ -262,7 +262,7 @@ simpl_top wanteds
; if something_happened
then do { wc_residual <- nestTcS (solveWantedsAndDrop wc)
; try_class_defaulting wc_residual }
- -- See Note [Overview of implicit CallStacks] in TcEvidence
+ -- See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
else try_callstack_defaulting wc }
try_callstack_defaulting :: WantedConstraints -> TcS WantedConstraints
@@ -274,7 +274,7 @@ simpl_top wanteds
-- | Default any remaining @CallStack@ constraints to empty @CallStack@s.
defaultCallStacks :: WantedConstraints -> TcS WantedConstraints
--- See Note [Overview of implicit CallStacks] in TcEvidence
+-- See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
defaultCallStacks wanteds
= do simples <- handle_simples (wc_simple wanteds)
mb_implics <- mapBagM handle_implic (wc_impl wanteds)
@@ -457,12 +457,12 @@ How is this implemented? It's complicated! So we'll step through it all:
list of instances that are unsafe to overlap. When the method call is safe,
the list is null.
- 2) `TcInteract.matchClassInst` -- This module drives the instance resolution
+ 2) `GHC.Tc.Solver.Interact.matchClassInst` -- This module drives the instance resolution
/ dictionary generation. The return type is `ClsInstResult`, which either
says no instance matched, or one found, and if it was a safe or unsafe
overlap.
- 3) `TcInteract.doTopReactDict` -- Takes a dictionary / class constraint and
+ 3) `GHC.Tc.Solver.Interact.doTopReactDict` -- Takes a dictionary / class constraint and
tries to resolve it by calling (in part) `matchClassInst`. The resolving
mechanism has a work list (of constraints) that it process one at a time. If
the constraint can't be resolved, it's added to an inert set. When compiling
@@ -476,7 +476,7 @@ How is this implemented? It's complicated! So we'll step through it all:
the unsafe (but resolved!) constraint to the `inert_safehask` field of
`InertCans`.
- 4) `TcSimplify.simplifyTop`:
+ 4) `GHC.Tc.Solver.simplifyTop`:
* Call simpl_top, the top-level function for driving the simplifier for
constraint resolution.
@@ -486,25 +486,25 @@ How is this implemented? It's complicated! So we'll step through it all:
(`-Wunsafe`) or inferring a module unsafe. `-XSafe` and `-XTrustworthy`
cause compilation failure by not resolving the unsafe constraint at all.
- * For unresolved constraints (all types), call `TcErrors.reportUnsolved`,
+ * For unresolved constraints (all types), call `GHC.Tc.Errors.reportUnsolved`,
while for resolved but unsafe overlapping dictionary constraints, call
- `TcErrors.warnAllUnsolved`. Both functions convert constraints into a
+ `GHC.Tc.Errors.warnAllUnsolved`. Both functions convert constraints into a
warning message for the user.
* In the case of `warnAllUnsolved` for resolved, but unsafe
dictionary constraints, we collect the generated warning
- message (pop it) and call `TcRnMonad.recordUnsafeInfer` to
+ message (pop it) and call `GHC.Tc.Utils.Monad.recordUnsafeInfer` to
mark the module we are compiling as unsafe, passing the
warning message along as the reason.
- 5) `TcErrors.*Unsolved` -- Generates error messages for constraints by
+ 5) `GHC.Tc.Errors.*Unsolved` -- Generates error messages for constraints by
actually calling `InstEnv.lookupInstEnv` again! Yes, confusing, but all we
know is the constraint that is unresolved or unsafe. For dictionary, all we
know is that we need a dictionary of type C, but not what instances are
available and how they overlap. So we once again call `lookupInstEnv` to
figure that out so we can generate a helpful error message.
- 6) `TcRnMonad.recordUnsafeInfer` -- Save the unsafe result and reason in an
+ 6) `GHC.Tc.Utils.Monad.recordUnsafeInfer` -- Save the unsafe result and reason in an
IORef called `tcg_safeInfer`.
7) `GHC.Driver.Main.tcRnModule'` -- Reads `tcg_safeInfer` after type-checking, calling
@@ -717,7 +717,7 @@ To infer f's type we do the following:
* Gather the constraints for the RHS with ambient level *one more than*
the current one. This is done by the call
pushLevelAndCaptureConstraints (tcMonoBinds...)
- in TcBinds.tcPolyInfer
+ in GHC.Tc.Gen.Bind.tcPolyInfer
* Call simplifyInfer to simplify the constraints and decide what to
quantify over. We pass in the level used for the RHS constraints,
@@ -732,7 +732,7 @@ the let binding.
-- | How should we choose which constraints to quantify over?
data InferMode = ApplyMR -- ^ Apply the monomorphism restriction,
-- never quantifying over any constraints
- | EagerDefaulting -- ^ See Note [TcRnExprMode] in TcRnDriver,
+ | EagerDefaulting -- ^ See Note [TcRnExprMode] in GHC.Tc.Module,
-- the :type +d case; this mode refuses
-- to quantify over any defaultable constraint
| NoRestrictions -- ^ Quantify over any constraint that
@@ -1279,7 +1279,7 @@ growThetaTyVars theta tcvs
where
seed_tcvs = tcvs `unionVarSet` tyCoVarsOfTypes ips
(ips, non_ips) = partition isIPPred theta
- -- See Note [Inheriting implicit parameters] in TcType
+ -- See Note [Inheriting implicit parameters] in GHC.Tc.Utils.TcType
mk_next :: VarSet -> VarSet -- Maps current set to newly-grown ones
mk_next so_far = foldr (grow_one so_far) emptyVarSet non_ips
@@ -1366,8 +1366,8 @@ sure to quantify over them. This leads to several wrinkles:
In the signature for 'g', we cannot quantify over 'b' because it turns out to
get unified with 'a', which is free in g's environment. So we carefully
- refrain from bogusly quantifying, in TcSimplify.decideMonoTyVars. We
- report the error later, in TcBinds.chooseInferredQuantifiers.
+ refrain from bogusly quantifying, in GHC.Tc.Solver.decideMonoTyVars. We
+ report the error later, in GHC.Tc.Gen.Bind.chooseInferredQuantifiers.
Note [Growing the tau-tvs using constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1404,7 +1404,7 @@ Reasons:
I tried an alternative approach: simply failM, after emitting the
residual implication constraint; the exception will be caught in
-TcBinds.tcPolyBinds, which gives all the binders in the group the type
+GHC.Tc.Gen.Bind.tcPolyBinds, which gives all the binders in the group the type
(forall a. a). But that didn't work with -fdefer-type-errors, because
the recovery from failM emits no code at all, so there is no function
to run! But -fdefer-type-errors aspires to produce a runnable program.
@@ -1524,7 +1524,7 @@ solveWanteds wc@(WC { wc_simple = simples, wc_impl = implics })
; wc1 <- solveSimpleWanteds simples
-- Any insoluble constraints are in 'simples' and so get rewritten
- -- See Note [Rewrite insolubles] in TcSMonad
+ -- See Note [Rewrite insolubles] in GHC.Tc.Solver.Monad
; (floated_eqs, implics2) <- solveNestedImplications $
implics `unionBags` wc_impl wc1
@@ -1707,7 +1707,7 @@ solveImplication imp@(Implic { ic_tclvl = tclvl
where
-- TcLevels must be strictly increasing (see (ImplicInv) in
- -- Note [TcLevel and untouchable type variables] in TcType),
+ -- Note [TcLevel and untouchable type variables] in GHC.Tc.Utils.TcType),
-- and in fact I think they should always increase one level at a time.
-- Though sensible, this check causes lots of testsuite failures. It is
@@ -1799,7 +1799,7 @@ setImplicationStatus implic@(Implic { ic_status = status
checkBadTelescope :: Implication -> TcS Bool
-- True <=> the skolems form a bad telescope
--- See Note [Checking telescopes] in Constraint
+-- See Note [Checking telescopes] in GHC.Tc.Types.Constraint
checkBadTelescope (Implic { ic_telescope = m_telescope
, ic_skols = skols })
| isJust m_telescope
@@ -1967,7 +1967,7 @@ works:
then we may find [G] sc_sel (d1::Ord a) :: Eq a
[G] d2 :: Eq a
We want to discard d2 in favour of the superclass selection from
- the Ord dictionary. This is done by TcInteract.solveOneFromTheOther
+ the Ord dictionary. This is done by GHC.Tc.Solver.Interact.solveOneFromTheOther
See Note [Replacement vs keeping].
* To find (b) we need to know which evidence bindings are 'wanted';
@@ -2001,10 +2001,10 @@ works:
----- Reporting redundant constraints
-* TcErrors does the actual warning, in warnRedundantConstraints.
+* GHC.Tc.Errors does the actual warning, in warnRedundantConstraints.
* We don't report redundant givens for *every* implication; only
- for those which reply True to TcSimplify.warnRedundantGivens:
+ for those which reply True to GHC.Tc.Solver.warnRedundantGivens:
- For example, in a class declaration, the default method *can*
use the class constraint, but it certainly doesn't *have* to,
@@ -2020,10 +2020,10 @@ works:
disable it for the ambiguity check. Hence using two different
FunSigCtxts, one with the warn-redundant field set True, and the
other set False in
- - TcBinds.tcSpecPrag
- - TcBinds.tcTySig
+ - GHC.Tc.Gen.Bind.tcSpecPrag
+ - GHC.Tc.Gen.Bind.tcTySig
- This decision is taken in setImplicationStatus, rather than TcErrors
+ This decision is taken in setImplicationStatus, rather than GHC.Tc.Errors
so that we can discard implication constraints that we don't need.
So ics_dead consists only of the *reportable* redundant givens.
@@ -2069,7 +2069,7 @@ allow the implication to make progress.
promoteTyVar :: TcTyVar -> TcM (Bool, TcTyVar)
-- When we float a constraint out of an implication we must restore
--- invariant (WantedInv) in Note [TcLevel and untouchable type variables] in TcType
+-- invariant (WantedInv) in Note [TcLevel and untouchable type variables] in GHC.Tc.Utils.TcType
-- Return True <=> we did some promotion
-- Also returns either the original tyvar (no promotion) or the new one
-- See Note [Promoting unification variables]
@@ -2092,7 +2092,7 @@ promoteTyVarSet tvs
promoteTyVarTcS :: TcTyVar -> TcS ()
-- When we float a constraint out of an implication we must restore
--- invariant (WantedInv) in Note [TcLevel and untouchable type variables] in TcType
+-- invariant (WantedInv) in Note [TcLevel and untouchable type variables] in GHC.Tc.Utils.TcType
-- See Note [Promoting unification variables]
-- We don't just call promoteTyVar because we want to use unifyTyVar,
-- not writeMetaTyVar
@@ -2109,8 +2109,8 @@ defaultTyVarTcS the_tv
| isRuntimeRepVar the_tv
, not (isTyVarTyVar the_tv)
-- TyVarTvs should only be unified with a tyvar
- -- never with a type; c.f. TcMType.defaultTyVar
- -- and Note [Inferring kinds for type declarations] in TcTyClsDecls
+ -- never with a type; c.f. GHC.Tc.Utils.TcMType.defaultTyVar
+ -- and Note [Inferring kinds for type declarations] in GHC.Tc.TyCl
= do { traceTcS "defaultTyVarTcS RuntimeRep" (ppr the_tv)
; unifyTyVar the_tv liftedRepTy
; return True }
@@ -2236,7 +2236,7 @@ approximateWC to produce a list of candidate constraints. Then we MUST
a) Promote any meta-tyvars that have been floated out by
approximateWC, to restore invariant (WantedInv) described in
- Note [TcLevel and untouchable type variables] in TcType.
+ Note [TcLevel and untouchable type variables] in GHC.Tc.Utils.TcType.
b) Default the kind of any meta-tyvars that are not mentioned in
in the environment.
@@ -2464,7 +2464,7 @@ become touchable by being floated (perhaps by more than one level).
We had a very complicated rule previously, but this is nice and
simple. (To see the notes, look at this Note in a version of
-TcSimplify prior to Oct 2014).
+GHC.Tc.Solver prior to Oct 2014).
Note [Which equalities to float]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2480,7 +2480,7 @@ happen. In particular, float out equalities that are:
* Nominal. No point in floating (alpha ~R# ty), because we do not
unify representational equalities even if alpha is touchable.
- See Note [Do not unify representational equalities] in TcInteract.
+ See Note [Do not unify representational equalities] in GHC.Tc.Solver.Interact.
Note [Skolem escape]
~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/GHC/Tc/Solver/Canonical.hs
index fa24829694..c9d93b063e 100644
--- a/compiler/typecheck/TcCanonical.hs
+++ b/compiler/GHC/Tc/Solver/Canonical.hs
@@ -1,28 +1,28 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
-module TcCanonical(
+module GHC.Tc.Solver.Canonical(
canonicalize,
unifyDerived,
makeSuperClasses, maybeSym,
StopOrContinue(..), stopWith, continueWith,
- solveCallStack -- For TcSimplify
+ solveCallStack -- For GHC.Tc.Solver
) where
#include "HsVersions.h"
import GhcPrelude
-import Constraint
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
-import TcUnify( swapOverTyVars, metaTyVarUpdateOK, MetaTyVarUpdateResult(..) )
-import TcType
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.Unify( swapOverTyVars, metaTyVarUpdateOK, MetaTyVarUpdateResult(..) )
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
-import TcFlatten
-import TcSMonad
-import TcEvidence
-import TcEvTerm
+import GHC.Tc.Solver.Flatten
+import GHC.Tc.Solver.Monad
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.EvTerm
import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep -- cleverly decomposes types, good for completeness checking
@@ -30,7 +30,7 @@ import GHC.Core.Coercion
import GHC.Core
import GHC.Types.Id( idType, mkTemplateLocals )
import GHC.Core.FamInstEnv ( FamInstEnvs )
-import FamInst ( tcTopNormaliseNewTypeTF_maybe )
+import GHC.Tc.Instance.Family ( tcTopNormaliseNewTypeTF_maybe )
import GHC.Types.Var
import GHC.Types.Var.Env( mkInScopeSet )
import GHC.Types.Var.Set( delVarSetList )
@@ -75,7 +75,7 @@ about these constraints. So, first:
Then proceed depending on the shape of the constraint. Generally speaking,
each constraint gets flattened and then decomposed into one of several forms
-(see type Ct in TcRnTypes).
+(see type Ct in GHC.Tc.Types).
When an already-canonicalized constraint gets kicked out of the inert set,
it must be recanonicalized. But we know a bit about its shape from the
@@ -164,8 +164,8 @@ canClassNC ev cls tys
-- If we're given a CallStack constraint that arose from a function
-- call, we need to push the current call-site onto the stack instead
-- of solving it directly from a given.
- -- See Note [Overview of implicit CallStacks] in TcEvidence
- -- and Note [Solving CallStack constraints] in TcSMonad
+ -- See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
+ -- and Note [Solving CallStack constraints] in GHC.Tc.Solver.Monad
= do { -- First we emit a new constraint that will capture the
-- given CallStack.
; let new_loc = setCtLocOrigin loc (IPOccOrigin (HsIPName ip_name))
@@ -191,7 +191,7 @@ canClassNC ev cls tys
pred = ctEvPred ev
solveCallStack :: CtEvidence -> EvCallStack -> TcS ()
--- Also called from TcSimplify when defaulting call stacks
+-- Also called from GHC.Tc.Solver when defaulting call stacks
solveCallStack ev ev_cs = do
-- We're given ev_cs :: CallStack, but the evidence term should be a
-- dictionary, so we have to coerce ev_cs to a dictionary for
@@ -273,7 +273,7 @@ So here's the plan:
However stop if you encounter the same class twice. That is,
mkStrictSuperClasses expands eagerly, but has a conservative
- termination condition: see Note [Expanding superclasses] in TcType.
+ termination condition: see Note [Expanding superclasses] in GHC.Tc.Utils.TcType.
2. Solve the wanteds as usual, but do no further expansion of
superclasses for canonical CDictCans in solveSimpleGivens or
@@ -286,10 +286,10 @@ So here's the plan:
Note [Eagerly expand given superclasses].
3. If we have any remaining unsolved wanteds
- (see Note [When superclasses help] in Constraint)
+ (see Note [When superclasses help] in GHC.Tc.Types.Constraint)
try harder: take both the Givens and Wanteds, and expand
superclasses again. See the calls to expandSuperClasses in
- TcSimplify.simpl_loop and solveWanteds.
+ GHC.Tc.Solver.simpl_loop and solveWanteds.
This may succeed in generating (a finite number of) extra Givens,
and extra Deriveds. Both may help the proof.
@@ -304,7 +304,7 @@ So here's the plan:
(a ~ b) to get (a ~# b). This happened in #15290.
4. Go round to (2) again. This loop (2,3,4) is implemented
- in TcSimplify.simpl_loop.
+ in GHC.Tc.Solver.simpl_loop.
The cc_pend_sc flag in a CDictCan records whether the superclasses of
this constraint have been expanded. Specifically, in Step 3 we only
@@ -339,7 +339,7 @@ Then canClassNC gets the [G] d1: C a constraint, and eager emits superclasses
G] d2: D a, [G] d3: C a (psc). (The "psc" means it has its sc_pend flag set.)
When processing d3 we find a match with d1 in the inert set, and we always
keep the inert item (d1) if possible: see Note [Replacement vs keeping] in
-TcInteract. So d3 dies a quick, happy death.
+GHC.Tc.Solver.Interact. So d3 dies a quick, happy death.
Note [Eagerly expand given superclasses]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -360,7 +360,7 @@ instance declaration; but then we are stuck with (Bad a). Sigh.
This is really a case of non-confluent proofs, but to stop our users
complaining we expand one layer in advance.
-Note [Instance and Given overlap] in TcInteract.
+Note [Instance and Given overlap] in GHC.Tc.Solver.Interact.
We also want to do this if we have
@@ -487,7 +487,7 @@ the sc_theta_ids at all. So our final construction is
makeSuperClasses :: [Ct] -> TcS [Ct]
-- Returns strict superclasses, transitively, see Note [The superclasses story]
-- See Note [The superclass story]
--- The loop-breaking here follows Note [Expanding superclasses] in TcType
+-- The loop-breaking here follows Note [Expanding superclasses] in GHC.Tc.Utils.TcType
-- Specifically, for an incoming (C t) constraint, we return all of (C t)'s
-- superclasses, up to /and including/ the first repetition of C
--
@@ -579,7 +579,7 @@ mk_strict_superclasses rec_clss (CtGiven { ctev_evar = evar, ctev_loc = loc })
-- #10335
| GivenOrigin skol_info <- ctLocOrigin loc
- -- See Note [Solving superclass constraints] in TcInstDcls
+ -- See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
-- for explantation of this transformation for givens
= case skol_info of
InstSkol -> loc { ctl_origin = GivenOrigin (InstSC size) }
@@ -673,7 +673,7 @@ Coercible it is definitely useful
Moreover it's not hard to arrange; we just need to look up /equality/
constraints in the quantified-constraint environment, which we do in
-TcInteract.doTopReactOther.
+GHC.Tc.Solver.Interact.doTopReactOther.
There is a wrinkle though, in the case where 'theta' is empty, so
we have
@@ -690,7 +690,7 @@ and fails to simplify that any further. And it doesn't satisfy
isPredTy any more.
So for now we simply decline to take superclasses in the quantified
-case. Instead we have a special case in TcInteract.doTopReactOther,
+case. Instead we have a special case in GHC.Tc.Solver.Interact.doTopReactOther,
which looks for primitive equalities specially in the quantified
constraints.
@@ -783,25 +783,25 @@ Here are the moving parts
and classifyPredType analyses a PredType to decompose
the new forall-constraints
- * TcSMonad.InertCans gets an extra field, inert_insts,
+ * GHC.Tc.Solver.Monad.InertCans gets an extra field, inert_insts,
which holds all the Given forall-constraints. In effect,
such Given constraints are like local instance decls.
* When trying to solve a class constraint, via
- TcInteract.matchInstEnv, use the InstEnv from inert_insts
+ GHC.Tc.Solver.Interact.matchInstEnv, use the InstEnv from inert_insts
so that we include the local Given forall-constraints
- in the lookup. (See TcSMonad.getInstEnvs.)
+ in the lookup. (See GHC.Tc.Solver.Monad.getInstEnvs.)
- * TcCanonical.canForAll deals with solving a
+ * GHC.Tc.Solver.Canonical.canForAll deals with solving a
forall-constraint. See
Note [Solving a Wanted forall-constraint]
* We augment the kick-out code to kick out an inert
forall constraint if it can be rewritten by a new
- type equality; see TcSMonad.kick_out_rewritable
+ type equality; see GHC.Tc.Solver.Monad.kick_out_rewritable
Note that a quantified constraint is never /inferred/
-(by TcSimplify.simplifyInfer). A function can only have a
+(by GHC.Tc.Solver.simplifyInfer). A function can only have a
quantified constraint in its type if it is given an explicit
type signature.
@@ -1377,7 +1377,7 @@ can_eq_newtype_nc ev swapped ty1 ((gres, co), ty1') ty2 ps_ty2
; traverse_ keepAlive $ map gre_name gre_list
-- ...and similarly, if a newtype constructor was defined in the same
-- module, don't warn about it being unused.
- -- See Note [Tracking unused binding and imports] in TcRnTypes.
+ -- See Note [Tracking unused binding and imports] in GHC.Tc.Utils.
; new_ev <- rewriteEqEvidence ev swapped ty1' ps_ty2
(mkTcSymCo co) (mkTcReflCo Representational ps_ty2)
@@ -1678,7 +1678,7 @@ If we focus on (3) first, we'll substitute in (2), and now it's
identical to the given (1), so we succeed. But if we focus on (2)
first, and decompose it, we'll get (alpha ~R b), which is not soluble.
This is exactly like the question of overlapping Givens for class
-constraints: see Note [Instance and Given overlap] in TcInteract.
+constraints: see Note [Instance and Given overlap] in GHC.Tc.Solver.Interact.
Conclusion:
* Decompose [W] N s ~R N t iff there no given constraint that could
@@ -1811,9 +1811,9 @@ When an equality fails, we still want to rewrite the equality
all the way down, so that it accurately reflects
(a) the mutable reference substitution in force at start of solving
(b) any ty-binds in force at this point in solving
-See Note [Rewrite insolubles] in TcSMonad.
+See Note [Rewrite insolubles] in GHC.Tc.Solver.Monad.
And if we don't do this there is a bad danger that
-TcSimplify.applyTyVarDefaulting will find a variable
+GHC.Tc.Solver.applyTyVarDefaulting will find a variable
that has in fact been substituted.
Note [Do not decompose Given polytype equalities]
@@ -2148,7 +2148,7 @@ Wrinkles:
as canonical in the inert set. In particular, we must not unify tv.
If we did, the Wanted becomes a Given (effectively), and then can
rewrite other Wanteds. But that's bad: See Note [Wanteds to not rewrite Wanteds]
- in Constraint. The problem is about poor error messages. See #11198 for
+ in GHC.Tc.Types.Constraint. The problem is about poor error messages. See #11198 for
tales of destruction.
So, we have an invariant on CTyEqCan (TyEq:H) that the RHS does not have
diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/GHC/Tc/Solver/Flatten.hs
index 762938c971..e1a290fdf9 100644
--- a/compiler/typecheck/TcFlatten.hs
+++ b/compiler/GHC/Tc/Solver/Flatten.hs
@@ -2,7 +2,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcFlatten(
+module GHC.Tc.Solver.Flatten(
FlattenMode(..),
flatten, flattenKind, flattenArgsNom,
rewriteTyVar,
@@ -14,13 +14,13 @@ module TcFlatten(
import GhcPrelude
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Core.TyCo.Ppr ( pprTyVar )
-import Constraint
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep -- performs delicate algorithm on types
import GHC.Core.Coercion
@@ -28,7 +28,7 @@ import GHC.Types.Var
import GHC.Types.Var.Set
import GHC.Types.Var.Env
import Outputable
-import TcSMonad as TcS
+import GHC.Tc.Solver.Monad as TcS
import GHC.Types.Basic( SwapFlag(..) )
import Util
@@ -97,7 +97,7 @@ Note [The flattening story]
In contrast a [D] CFunEqCan /shares/ its fmv with its partner [W],
but does not "own" it. If we reduce a [D] F Int ~ fmv, where
say type instance F Int = ty, then we don't discharge fmv := ty.
- Rather we simply generate [D] fmv ~ ty (in TcInteract.reduce_top_fun_eq,
+ Rather we simply generate [D] fmv ~ ty (in GHC.Tc.Solver.Interact.reduce_top_fun_eq,
and dischargeFmv)
* Inert set invariant: if F xis1 ~ fsk1, F xis2 ~ fsk2
@@ -143,7 +143,7 @@ Note [The flattening story]
Always solve given from wanted if poss.
* For top-level reductions, see Note [Top-level reductions for type functions]
- in TcInteract
+ in GHC.Tc.Solver.Interact
Why given-fsks, alone, doesn't work
@@ -706,9 +706,9 @@ floating the types out means we normalise them, and that often makes
them smaller and perhaps allows more re-use of previously solved
goals. But to be honest I'm not absolutely certain, so I am leaving
FM_Avoid in the code base. What I'm removing is the unique place
-where it is *used*, namely in TcCanonical.canEqTyVar.
+where it is *used*, namely in GHC.Tc.Solver.Canonical.canEqTyVar.
-See also Note [Conservative unification check] in TcUnify, which gives
+See also Note [Conservative unification check] in GHC.Tc.Utils.Unify, which gives
other examples where lazy flattening caused problems.
Bottom line: FM_Avoid is unused for now (Nov 14).
@@ -766,7 +766,7 @@ when trying to find derived equalities arising from injectivity.
-- If (xi, co) <- flatten mode ev ty, then co :: xi ~r ty
-- where r is the role in @ev@. If @mode@ is 'FM_FlattenAll',
-- then 'xi' is almost function-free (Note [Almost function-free]
--- in TcRnTypes).
+-- in GHC.Tc.Types).
flatten :: FlattenMode -> CtEvidence -> TcType
-> TcS (Xi, TcCoercion)
flatten mode ev ty
@@ -777,7 +777,7 @@ flatten mode ev ty
-- Apply the inert set as an *inert generalised substitution* to
-- a variable, zonking along the way.
--- See Note [inert_eqs: the inert equalities] in TcSMonad.
+-- See Note [inert_eqs: the inert equalities] in GHC.Tc.Solver.Monad.
-- Equivalently, this flattens the variable with respect to NomEq
-- in a Derived constraint. (Why Derived? Because Derived allows the
-- most about of rewriting.) Returns no coercion, because we're
@@ -854,7 +854,7 @@ Flattening also:
* applies the substitution embodied in the inert set
The result of flattening is *almost function-free*. See
-Note [Almost function-free] in TcRnTypes.
+Note [Almost function-free] in GHC.Tc.Utils.
Because flattening zonks and the returned coercion ("co" above) is also
zonked, it's possible that (co :: xi ~ ty) isn't quite true. So, instead,
@@ -872,7 +872,7 @@ case in flattenTyVar.
Why have these invariants on flattening? Because we sometimes use tcTypeKind
during canonicalisation, and we want this kind to be zonked (e.g., see
-TcCanonical.canEqTyVar).
+GHC.Tc.Solver.Canonical.canEqTyVar).
Flattening is always homogeneous. That is, the kind of the result of flattening is
always the same as the kind of the input, modulo zonking. More formally:
@@ -1313,7 +1313,7 @@ Suppose
and we want to flatten the type (T (F a)). Then we can safely flatten
the (F a) to a skolem, and return (T fsk). We don't need to expand the
synonym. This works because TcTyConAppCo can deal with synonyms
-(unlike TyConAppCo), see Note [TcCoercions] in TcEvidence.
+(unlike TyConAppCo), see Note [TcCoercions] in GHC.Tc.Types.Evidence.
But (#8979) for
type T a = (F a, a) where F is a type function
@@ -1397,7 +1397,7 @@ flatten_exact_fam_app_fully tc tys
; case mb_ct of
Just (co, rhs_ty, flav) -- co :: F xis ~ fsk
-- flav is [G] or [WD]
- -- See Note [Type family equations] in TcSMonad
+ -- See Note [Type family equations] in GHC.Tc.Solver.Monad
| (NotSwapped, _) <- flav `funEqCanDischargeF` cur_flav
-> -- Usable hit in the flat-cache
do { traceFlat "flatten/flat-cache hit" $
@@ -1607,8 +1607,8 @@ flatten_tyvar1 tv
flatten_tyvar2 :: TcTyVar -> CtFlavourRole -> FlatM FlattenTvResult
-- The tyvar is not a filled-in meta-tyvar
-- Try in the inert equalities
--- See Definition [Applying a generalised substitution] in TcSMonad
--- See Note [Stability of flattening] in TcSMonad
+-- See Definition [Applying a generalised substitution] in GHC.Tc.Solver.Monad
+-- See Note [Stability of flattening] in GHC.Tc.Solver.Monad
flatten_tyvar2 tv fr@(_, eq_rel)
= do { ieqs <- liftTcS $ getInertEqs
@@ -1658,7 +1658,7 @@ This means that flattening must be recursive, but it does allow
[G] b ~ Maybe c
This avoids "saturating" the Givens, which can save a modest amount of work.
-It is easy to implement, in TcInteract.kick_out, by only kicking out an inert
+It is easy to implement, in GHC.Tc.Solver.Interact.kick_out, by only kicking out an inert
only if (a) the work item can rewrite the inert AND
(b) the inert cannot rewrite the work item
@@ -1791,7 +1791,7 @@ unflattenWanteds tv_eqs funeqs
, cc_rhs = rhs, cc_eq_rel = eq_rel }) rest
| NomEq <- eq_rel -- See Note [Do not unify representational equalities]
- -- in TcInteract
+ -- in GHC.Tc.Solver.Interact
, isFmvTyVar tv -- Previously these fmvs were untouchable,
-- but now they are touchable
-- NB: unlike unflattenFmv, filling a fmv here /does/
diff --git a/compiler/typecheck/TcInteract.hs b/compiler/GHC/Tc/Solver/Interact.hs
index d0f1e0d1b1..f9e0562c7b 100644
--- a/compiler/typecheck/TcInteract.hs
+++ b/compiler/GHC/Tc/Solver/Interact.hs
@@ -3,7 +3,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcInteract (
+module GHC.Tc.Solver.Interact (
solveSimpleGivens, -- Solves [Ct]
solveSimpleWanteds, -- Solves Cts
) where
@@ -13,9 +13,9 @@ module TcInteract (
import GhcPrelude
import GHC.Types.Basic ( SwapFlag(..), isSwapped,
infinity, IntWithInf, intGtLimit )
-import TcCanonical
-import TcFlatten
-import TcUnify( canSolveByUnification )
+import GHC.Tc.Solver.Canonical
+import GHC.Tc.Solver.Flatten
+import GHC.Tc.Utils.Unify( canSolveByUnification )
import GHC.Types.Var.Set
import GHC.Core.Type as Type
import GHC.Core.Coercion ( BlockSubstFlag(..) )
@@ -23,26 +23,26 @@ import GHC.Core.InstEnv ( DFunInstType )
import GHC.Core.Coercion.Axiom ( sfInteractTop, sfInteractInert )
import GHC.Types.Var
-import TcType
+import GHC.Tc.Utils.TcType
import PrelNames ( coercibleTyConKey,
heqTyConKey, eqTyConKey, ipClassKey )
import GHC.Core.Coercion.Axiom ( TypeEqn, CoAxiom(..), CoAxBranch(..), fromBranches )
import GHC.Core.Class
import GHC.Core.TyCon
-import FunDeps
-import FamInst
-import ClsInst( InstanceWhat(..), safeOverlap )
+import GHC.Tc.Instance.FunDeps
+import GHC.Tc.Instance.Family
+import GHC.Tc.Instance.Class( InstanceWhat(..), safeOverlap )
import GHC.Core.FamInstEnv
import GHC.Core.Unify ( tcUnifyTyWithTFs, ruleMatchTyKiX )
-import TcEvidence
+import GHC.Tc.Types.Evidence
import Outputable
-import TcRnTypes
-import Constraint
+import GHC.Tc.Types
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
-import TcSMonad
+import GHC.Tc.Types.Origin
+import GHC.Tc.Solver.Monad
import Bag
import MonadUtils ( concatMapM, foldlM )
@@ -217,7 +217,7 @@ Solving a bunch of simple constraints is done in a loop,
wants to run again, go back to step 1
Non-obviously, improvement can also take place during
-the unflattening that takes place in step (1). See TcFlatten,
+the unflattening that takes place in step (1). See GHC.Tc.Solver.Flatten,
See Note [Unflattening can force the solver to iterate]
-}
@@ -442,7 +442,7 @@ React with (F Int ~ b) ==> IR Stop True [] -- after substituting we re-canoni
-}
thePipeline :: [(String,SimplifierStage)]
-thePipeline = [ ("canonicalization", TcCanonical.canonicalize)
+thePipeline = [ ("canonicalization", GHC.Tc.Solver.Canonical.canonicalize)
, ("interact with inerts", interactWithInertsStage)
, ("top-level reactions", topReactionsStage) ]
@@ -606,7 +606,7 @@ we keep? More subtle than you might think!
- For everything else, we want to keep the outermost one. Reason: that
makes it more likely that the inner one will turn out to be unused,
and can be reported as redundant. See Note [Tracking redundant constraints]
- in TcSimplify.
+ in GHC.Tc.Solver.
It transpires that using the outermost one is responsible for an
8% performance improvement in nofib cryptarithm2, compared to
@@ -617,7 +617,7 @@ we keep? More subtle than you might think!
(a) Always get rid of InstSC ones if possible, since they are less
useful for solving. If both are InstSC, choose the one with
the smallest TypeSize
- See Note [Solving superclass constraints] in TcInstDcls
+ See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
(b) Keep the one that has a non-trivial evidence binding.
Example: f :: (Eq a, Ord a) => blah
@@ -626,7 +626,7 @@ we keep? More subtle than you might think!
with bindings d3 = sc_sel (d1::Ord a)
We want to discard d2 in favour of the superclass selection from
the Ord dictionary.
- Why? See Note [Tracking redundant constraints] in TcSimplify again.
+ Why? See Note [Tracking redundant constraints] in GHC.Tc.Solver again.
(c) But don't do (b) if the evidence binding depends transitively on the
one without a binding. Example (with RecursiveSuperClasses)
@@ -641,7 +641,7 @@ we keep? More subtle than you might think!
* Finally, when there is still a choice, use KeepInert rather than
KeepWork, for two reasons:
- to avoid unnecessary munging of the inert set.
- - to cut off superclass loops; see Note [Superclass loops] in TcCanonical
+ - to cut off superclass loops; see Note [Superclass loops] in GHC.Tc.Solver.Canonical
Doing the depth-check for implicit parameters, rather than making the work item
always override, is important. Consider
@@ -1643,7 +1643,7 @@ solveByUnification :: CtEvidence -> TcTyVar -> Xi -> TcS ()
-- NB: No need for an occurs check here, because solveByUnification always
-- arises from a CTyEqCan, a *canonical* constraint. Its invariant (TyEq:OC)
-- says that in (a ~ xi), the type variable a does not appear in xi.
--- See Constraint.Ct invariants.
+-- See GHC.Tc.Types.Constraint.Ct invariants.
--
-- Post: tv is unified (by side effect) with xi;
-- we often write tv := xi
@@ -1672,7 +1672,7 @@ We avoid this problem by orienting the resulting given so that the unification
variable is on the left. [Note that alternatively we could attempt to
enforce this at canonicalization]
-See also Note [No touchables as FunEq RHS] in TcSMonad; avoiding
+See also Note [No touchables as FunEq RHS] in GHC.Tc.Solver.Monad; avoiding
double unifications is the main reason we disallow touchable
unification variables as RHS of type family equations: F xis ~ alpha.
@@ -1712,7 +1712,7 @@ constraint right away. This avoids two dangers
with the same thing later, and produce the same equality
again --> termination worries.
-To achieve this required some refactoring of FunDeps.hs (nicer
+To achieve this required some refactoring of GHC.Tc.Instance.FunDeps (nicer
now!).
Note [FunDep and implicit parameter reactions]
@@ -1831,7 +1831,7 @@ doTopReactOther :: Ct -> TcS (StopOrContinue Ct)
-- CTyEqCan e.g. (a ~# ty)
-- and CIrredCan e.g. (c a)
--
--- Why equalities? See TcCanonical
+-- Why equalities? See GHC.Tc.Solver.Canonical
-- Note [Equality superclasses in quantified constraints]
doTopReactOther work_item
| isGiven ev
@@ -1884,7 +1884,7 @@ kind is not Constraint, such as (forall a. F a ~# b)
See
* Note [Evidence for quantified constraints] in GHC.Core.Predicate
* Note [Equality superclasses in quantified constraints]
- in TcCanonical
+ in GHC.Tc.Solver.Canonical
Note [Flatten when discharging CFunEqCan]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1933,7 +1933,7 @@ level go, though? It can't just go on the reduct, as that's a type. Instead,
it must go on any CFunEqCans produced after flattening. We thus flatten
when discharging, making sure that the level is bumped in the new
fun-eqs. The flattening happens in reduce_top_fun_eq and the level
-is bumped when setting up the FlatM monad in TcFlatten.runFlatten.
+is bumped when setting up the FlatM monad in GHC.Tc.Solver.Flatten.runFlatten.
(This bumping will happen for call sites other than this one, but that
makes sense -- any constraints emitted by the flattener are offshoots
the work item and should have a higher level. We don't have any test
@@ -2092,7 +2092,7 @@ shortCutReduction :: CtEvidence -> TcTyVar -> TcCoercion
-- See Note [Top-level reductions for type functions]
-- Previously, we flattened the tc_args here, but there's no need to do so.
-- And, if we did, this function would have all the complication of
--- TcCanonical.canCFunEqCan. See Note [canCFunEqCan]
+-- GHC.Tc.Solver.Canonical.canCFunEqCan. See Note [canCFunEqCan]
shortCutReduction old_ev fsk ax_co fam_tc tc_args
= ASSERT( ctEvEqRel old_ev == NomEq)
-- ax_co :: F args ~ G tc_args
@@ -2120,7 +2120,7 @@ shortCutReduction old_ev fsk ax_co fam_tc tc_args
{- Note [Top-level reductions for type functions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-c.f. Note [The flattening story] in TcFlatten
+c.f. Note [The flattening story] in GHC.Tc.Solver.Flatten
Suppose we have a CFunEqCan F tys ~ fmv/fsk, and a matching axiom.
Here is what we do, in four cases:
@@ -2262,7 +2262,7 @@ We don't do improvements (injectivity etc) for Givens. Why?
e.g. (a < b), (b < c) ==> a < c If we generate a Derived for this,
we'll generate a Derived/Wanted CFunEqCan; and, since the same
InertCans (after solving Givens) are used for each iteration, that
- massively confused the unflattening step (TcFlatten.unflatten).
+ massively confused the unflattening step (GHC.Tc.Solver.Flatten.unflatten).
In fact it led to some infinite loops:
indexed-types/should_compile/T10806
@@ -2580,7 +2580,7 @@ Other notes:
All of this is disgustingly delicate, so to discourage people from writing
simplifiable class givens, we warn about signatures that contain them;
-see TcValidity Note [Simplifiable given constraints].
+see GHC.Tc.Validity Note [Simplifiable given constraints].
Note [Naturally coherent classes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2609,7 +2609,7 @@ The same reasoning applies to
And less obviously to:
-* Tuple classes. For reasons described in TcSMonad
+* Tuple classes. For reasons described in GHC.Tc.Solver.Monad
Note [Tuples hiding implicit parameters], we may have a constraint
[W] (?x::Int, C a)
with an exactly-matching Given constraint. We must decompose this
diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/GHC/Tc/Solver/Monad.hs
index bddbcd0451..0aea474320 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/GHC/Tc/Solver/Monad.hs
@@ -2,8 +2,8 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
--- Type definitions for the constraint solver
-module TcSMonad (
+-- | Type definitions for the constraint solver
+module GHC.Tc.Solver.Monad (
-- The work list
WorkList(..), isEmptyWorkList, emptyWorkList,
@@ -120,7 +120,7 @@ module TcSMonad (
checkWellStagedDFun,
pprEq -- Smaller utils, re-exported from TcM
-- TODO (DV): these are only really used in the
- -- instance matcher in TcSimplify. I am wondering
+ -- instance matcher in GHC.Tc.Solver. I am wondering
-- if the whole instance matcher simply belongs
-- here
) where
@@ -131,28 +131,28 @@ import GhcPrelude
import GHC.Driver.Types
-import qualified Inst as TcM
+import qualified GHC.Tc.Utils.Instantiate as TcM
import GHC.Core.InstEnv
-import FamInst
+import GHC.Tc.Instance.Family as FamInst
import GHC.Core.FamInstEnv
-import qualified TcRnMonad as TcM
-import qualified TcMType as TcM
-import qualified ClsInst as TcM( matchGlobalInst, ClsInstResult(..) )
-import qualified TcEnv as TcM
+import qualified GHC.Tc.Utils.Monad as TcM
+import qualified GHC.Tc.Utils.TcMType as TcM
+import qualified GHC.Tc.Instance.Class as TcM( matchGlobalInst, ClsInstResult(..) )
+import qualified GHC.Tc.Utils.Env as TcM
( checkWellStaged, tcGetDefaultTys, tcLookupClass, tcLookupId, topIdLvl )
-import ClsInst( InstanceWhat(..), safeOverlap, instanceReturnsDictCon )
-import TcType
+import GHC.Tc.Instance.Class( InstanceWhat(..), safeOverlap, instanceReturnsDictCon )
+import GHC.Tc.Utils.TcType
import GHC.Driver.Session
import GHC.Core.Type
import GHC.Core.Coercion
import GHC.Core.Unify
import ErrUtils
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core.Class
import GHC.Core.TyCon
-import TcErrors ( solverDepthErrorTcS )
+import GHC.Tc.Errors ( solverDepthErrorTcS )
import GHC.Types.Name
import GHC.Types.Module ( HasModule, getModule )
@@ -165,9 +165,9 @@ import Outputable
import Bag
import GHC.Types.Unique.Supply
import Util
-import TcRnTypes
-import TcOrigin
-import Constraint
+import GHC.Tc.Types
+import GHC.Tc.Types.Origin
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
import GHC.Types.Unique
@@ -375,7 +375,7 @@ selectNextWorkItem
Nothing -> return Nothing ;
Just (ct, new_wl) ->
do { -- checkReductionDepth (ctLoc ct) (ctPred ct)
- -- This is done by TcInteract.chooseInstance
+ -- This is done by GHC.Tc.Solver.Interact.chooseInstance
; writeTcRef wl_var new_wl
; return (Just ct) } } }
@@ -505,7 +505,7 @@ VERY IMPORTANT INVARIANT:
non-bottom, which in turn ensures that the whole "recursive
dictionary" idea works at all, even if we get something like
rec { d = dfunDList d dx }
- See Note [Recursive superclasses] in TcInstDcls.
+ See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance.
Reason:
- All instances, except two exceptions listed below, "take a step"
@@ -530,11 +530,11 @@ THEREFORE we only add a "solved dictionary"
- subject to Exceptions 1 and 2 above
In implementation terms
- - TcSMonad.addSolvedDict adds a new solved dictionary,
+ - GHC.Tc.Solver.Monad.addSolvedDict adds a new solved dictionary,
conditional on the kind of instance
- It is only called when applying an instance decl,
- in TcInteract.doTopReactDict
+ in GHC.Tc.Solver.Interact.doTopReactDict
- ClsInst.InstanceWhat says what kind of instance was
used to solve the constraint. In particular
@@ -728,7 +728,7 @@ data InertCans -- See Note [Detailed InertCans Invariants] for more
-- failure.
--
-- ^ See Note [Safe Haskell Overlapping Instances Implementation]
- -- in TcSimplify
+ -- in GHC.Tc.Solver
, inert_irreds :: Cts
-- Irreducible predicates that cannot be made canonical,
@@ -912,7 +912,7 @@ Main Theorem [Stability under extension]
Conditions (T1-T3) are established by the canonicaliser
-Conditions (K1-K3) are established by TcSMonad.kickOutRewritable
+Conditions (K1-K3) are established by GHC.Tc.Solver.Monad.kickOutRewritable
The idea is that
* (T1-2) are guaranteed by exhaustively rewriting the work-item
@@ -1105,7 +1105,7 @@ instance Outputable InertCans where
Note [The improvement story and derived shadows]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Because Wanteds cannot rewrite Wanteds (see Note [Wanteds do not
-rewrite Wanteds] in Constraint), we may miss some opportunities for
+rewrite Wanteds] in GHC.Tc.Types.Constraint), we may miss some opportunities for
solving. Here's a classic example (indexed-types/should_fail/T4093a)
Ambiguity check for f: (Foo e ~ Maybe e) => Foo e
@@ -1736,7 +1736,7 @@ kick_out_rewritable new_fr new_tv
-- we can rewrite 'c' to something more useful
-- Kick-out for inert instances
- -- See Note [Quantified constraints] in TcCanonical
+ -- See Note [Quantified constraints] in GHC.Tc.Solver.Canonical
insts_out :: [Ct]
insts_in :: [QCInst]
(insts_out, insts_in)
@@ -1901,14 +1901,14 @@ Givens, to give as informative an error messasge as possible
(#12468, #11325).
Hence:
- * In the main simplifier loops in TcSimplify (solveWanteds,
+ * In the main simplifier loops in GHC.Tc.Solver (solveWanteds,
simpl_loop), we feed the insolubles in solveSimpleWanteds,
so that they get rewritten (albeit not solved).
* We kick insolubles out of the inert set, if they can be
- rewritten (see TcSMonad.kick_out_rewritable)
+ rewritten (see GHC.Tc.Solver.Monad.kick_out_rewritable)
- * We rewrite those insolubles in TcCanonical.
+ * We rewrite those insolubles in GHC.Tc.Solver.Canonical.
See Note [Make sure that insolubles are fully rewritten]
-}
@@ -1923,13 +1923,13 @@ addInertSafehask _ item
= pprPanic "addInertSafehask: can't happen! Inserting " $ ppr item
insertSafeOverlapFailureTcS :: InstanceWhat -> Ct -> TcS ()
--- See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
+-- See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
insertSafeOverlapFailureTcS what item
| safeOverlap what = return ()
| otherwise = updInertCans (\ics -> addInertSafehask ics item)
getSafeOverlapFailures :: TcS Cts
--- See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
+-- See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
getSafeOverlapFailures
= do { IC { inert_safehask = safehask } <- getInertCans
; return $ foldDicts consCts safehask emptyCts }
@@ -2074,7 +2074,7 @@ get_sc_pending this_lvl ic@(IC { inert_dicts = dicts, inert_insts = insts })
belongs_to_this_level ev = ctLocLevel (ctEvLoc ev) == this_lvl
-- We only want Givens from this level; see (3a) in
- -- Note [The superclass story] in TcCanonical
+ -- Note [The superclass story] in GHC.Tc.Solver.Canonical
getUnsolvedInerts :: TcS ( Bag Implication
, Cts -- Tyvar eqs: a ~ ty
@@ -2182,7 +2182,7 @@ getNoGivenEqs tclvl skol_tvs
-- | Returns Given constraints that might,
-- potentially, match the given pred. This is used when checking to see if a
-- Given might overlap with an instance. See Note [Instance and Given overlap]
--- in TcInteract.
+-- in GHC.Tc.Solver.Interact.
matchableGivens :: CtLoc -> PredType -> InertSet -> Cts
matchableGivens loc_w pred_w (IS { inert_cans = inert_cans })
= filterBag matchable_given all_relevant_givens
@@ -2218,13 +2218,13 @@ mightMatchLater given_pred given_loc wanted_pred wanted_loc
-- conservatively assume that a meta tyvar might get unified with
-- something that matches the 'given', until demonstrated
-- otherwise. More info in Note [Instance and Given overlap]
- -- in TcInteract
+ -- in GHC.Tc.Solver.Interact
bind_meta_tv tv | isMetaTyVar tv
, not (isFskTyVar tv) = BindMe
| otherwise = Skolem
prohibitedSuperClassSolve :: CtLoc -> CtLoc -> Bool
--- See Note [Solving superclass constraints] in TcInstDcls
+-- See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
prohibitedSuperClassSolve from_loc solve_loc
| GivenOrigin (InstSC given_size) <- ctLocOrigin from_loc
, ScOrigin wanted_size <- ctLocOrigin solve_loc
@@ -2301,7 +2301,7 @@ b) 'a' will have been completely substituted out in the inert set,
For an example, see #9211.
-See also TcUnify Note [Deeper level on the left] for how we ensure
+See also GHC.Tc.Utils.Unify Note [Deeper level on the left] for how we ensure
that the right variable is on the left of the equality when both are
tyvars.
@@ -2510,9 +2510,9 @@ Suppose f :: HasCallStack => blah. Then
with a CtOrigin that says "OccurrenceOf f".
Remember that HasCallStack is just shorthand for
IP "callStack CallStack
- See Note [Overview of implicit CallStacks] in TcEvidence
+ See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
-* We cannonicalise such constraints, in TcCanonical.canClassNC, by
+* We cannonicalise such constraints, in GHC.Tc.Solver.Canonical.canClassNC, by
pushing the call-site info on the stack, and changing the CtOrigin
to record that has been done.
Bind: s1 = pushCallStack <site-info> s2
@@ -2736,7 +2736,7 @@ addErrTcS :: SDoc -> TcS ()
failTcS = wrapTcS . TcM.failWith
warnTcS flag = wrapTcS . TcM.addWarn (Reason flag)
addErrTcS = wrapTcS . TcM.addErr
-panicTcS doc = pprPanic "TcCanonical" doc
+panicTcS doc = pprPanic "GHC.Tc.Solver.Canonical" doc
traceTcS :: String -> SDoc -> TcS ()
traceTcS herald doc = wrapTcS (TcM.traceTc herald doc)
@@ -2993,7 +2993,7 @@ the inner implications, and it can make a significant performance difference
if you do so.
-}
--- Getters and setters of TcEnv fields
+-- Getters and setters of GHC.Tc.Utils.Env fields
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Getter of inerts and worklist
@@ -3024,7 +3024,7 @@ pushLevelNoWorkList err_doc (TcS thing_inside)
thing_inside (env { tcs_worklist = wl_panic })
)
where
- wl_panic = pprPanic "TcSMonad.buildImplication" err_doc
+ wl_panic = pprPanic "GHC.Tc.Solver.Monad.buildImplication" err_doc
-- This panic checks that the thing-inside
-- does not emit any work-list constraints
#else
@@ -3250,7 +3250,7 @@ unflattenGivens :: IORef InertSet -> TcM ()
-- NB: this is the /only/ way that a fsk (MetaDetails = FlatSkolTv)
-- is filled in. Nothing else does so.
--
--- It's here (rather than in TcFlatten) because the Right Places
+-- It's here (rather than in GHC.Tc.Solver.Flatten) because the Right Places
-- to call it are in runTcSWithEvBinds/nestImplicTcS, where it
-- is nicely paired with the creation an empty inert_fsks list.
unflattenGivens inert_var
@@ -3305,7 +3305,7 @@ dischargeFunEq :: CtEvidence -> TcTyVar -> TcCoercion -> TcType -> TcS ()
-- - co :: F tys ~ xi
-- - fmv/fsk `notElem` xi
-- - fmv not filled (for Wanteds)
--- - xi is flattened (and obeys Note [Almost function-free] in TcRnTypes)
+-- - xi is flattened (and obeys Note [Almost function-free] in GHC.Tc.Types)
--
-- Then for [W] or [WD], we actually fill in the fmv:
-- set fmv := xi,
@@ -3319,7 +3319,7 @@ dischargeFunEq :: CtEvidence -> TcTyVar -> TcCoercion -> TcType -> TcS ()
-- For [G], emit this equality
-- [G] (sym ev; co) :: fsk ~ xi
--- See TcFlatten Note [The flattening story],
+-- See GHC.Tc.Solver.Flatten Note [The flattening story],
-- especially "Ownership of fsk/fmv"
dischargeFunEq (CtGiven { ctev_evar = old_evar, ctev_loc = loc }) fsk co xi
= do { new_ev <- newGivenEvVar loc ( new_pred, evCoercion new_co )
@@ -3485,7 +3485,7 @@ newGivenEvVar :: CtLoc -> (TcPredType, EvTerm) -> TcS CtEvidence
-- Make a new variable of the given PredType,
-- immediately bind it to the given term
-- and return its CtEvidence
--- See Note [Bind new Givens immediately] in Constraint
+-- See Note [Bind new Givens immediately] in GHC.Tc.Types.Constraint
newGivenEvVar loc (pred, rhs)
= do { new_ev <- newBoundEvVarId pred rhs
; return (CtGiven { ctev_pred = pred, ctev_evar = new_ev, ctev_loc = loc }) }
@@ -3599,7 +3599,7 @@ newDerivedNC loc pred
= do { -- checkReductionDepth loc pred
; return (CtDerived { ctev_pred = pred, ctev_loc = loc }) }
--- --------- Check done in TcInteract.selectNewWorkItem???? ---------
+-- --------- Check done in GHC.Tc.Solver.Interact.selectNewWorkItem???? ---------
-- | Checks if the depth of the given location is too much. Fails if
-- it's too big, with an appropriate error message.
checkReductionDepth :: CtLoc -> TcType -- ^ type being reduced
@@ -3639,5 +3639,5 @@ current worklist. Specifically, when canonicalising
(forall a. t1 ~ forall a. t2)
from which we get the implication
(forall a. t1 ~ t2)
-See TcSMonad.deferTcSForAllEq
+See GHC.Tc.Solver.Monad.deferTcSForAllEq
-}
diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/GHC/Tc/TyCl.hs
index b69a4654f3..2a21b8a61c 100644
--- a/compiler/typecheck/TcTyClsDecls.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1996-1998
-
-TcTyClsDecls: Typecheck type and class declarations
-}
{-# LANGUAGE CPP, TupleSections, ScopedTypeVariables, MultiWayIf #-}
@@ -12,10 +10,11 @@ TcTyClsDecls: Typecheck type and class declarations
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcTyClsDecls (
+-- | Typecheck type and class declarations
+module GHC.Tc.TyCl (
tcTyAndClassDecls,
- -- Functions used by TcInstDcls to check
+ -- Functions used by GHC.Tc.TyCl.Instance to check
-- data/type family instance declarations
kcConDecls, tcConDecls, dataDeclChecks, checkValidTyCon,
tcFamTyPats, tcTyFamInstEqn,
@@ -30,26 +29,26 @@ import GhcPrelude
import GHC.Hs
import GHC.Driver.Types
-import BuildTyCl
-import TcRnMonad
-import TcEnv
-import TcValidity
-import TcHsSyn
-import TcTyDecls
-import TcClassDcl
-import {-# SOURCE #-} TcInstDcls( tcInstDecls1 )
-import TcDeriv (DerivInfo(..))
-import TcUnify ( checkTvConstraints )
-import TcHsType
-import ClsInst( AssocInstInfo(..) )
-import TcMType
+import GHC.Tc.TyCl.Build
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Validity
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.TyCl.Utils
+import GHC.Tc.TyCl.Class
+import {-# SOURCE #-} GHC.Tc.TyCl.Instance( tcInstDecls1 )
+import GHC.Tc.Deriv (DerivInfo(..))
+import GHC.Tc.Utils.Unify ( checkTvConstraints )
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Instance.Class( AssocInstInfo(..) )
+import GHC.Tc.Utils.TcMType
import TysWiredIn ( unitTy, makeRecoveryTyCon )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Rename.Env( lookupConstructorFields )
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import GHC.Core.Coercion
-import TcOrigin
+import GHC.Tc.Types.Origin
import GHC.Core.Type
import GHC.Core.TyCo.Rep -- for checkValidRoles
import GHC.Core.TyCo.Ppr( pprTyVars, pprWithExplicitKindsWhen )
@@ -379,7 +378,7 @@ TcTyCons are used for two distinct purposes
way that won't lead to more errors. We use a TcTyCon for this;
see makeRecoveryTyCon.
-2. When checking a type/class declaration (in module TcTyClsDecls), we come
+2. When checking a type/class declaration (in module GHC.Tc.TyCl), we come
upon knowledge of the eventual tycon in bits and pieces.
S1) First, we use inferInitialKinds to look over the user-provided
@@ -401,7 +400,7 @@ TcTyCons are used for two distinct purposes
For convenience, we store partially-known tycons in TcTyCons, which
might store meta-variables. These TcTyCons are stored in the local
- environment in TcTyClsDecls, until the real full TyCons can be created
+ environment in GHC.Tc.TyCl, until the real full TyCons can be created
during desugaring. A desugared program should never have a TcTyCon.
3. In a TcTyCon, everything is zonked after the kind-checking pass (S2).
@@ -417,11 +416,11 @@ TcTyCons are used for two distinct purposes
inferred kind. Because the tycon might not have a CUSK, this
matching up is, in general, quite hard to do. (Look through the
git history between Dec 2015 and Apr 2016 for
- TcHsType.splitTelescopeTvs!)
+ GHC.Tc.Gen.HsType.splitTelescopeTvs!)
Instead of trying, we just store the list of type variables to
bring into scope, in the tyConScopedTyVars field of the TcTyCon.
- These tyvars are brought into scope in TcHsType.bindTyClTyVars.
+ These tyvars are brought into scope in GHC.Tc.Gen.HsType.bindTyClTyVars.
In a TcTyCon, why is tyConScopedTyVars :: [(Name,TcTyVar)] rather
than just [TcTyVar]? Consider these mutually-recursive decls
@@ -741,7 +740,7 @@ swizzleTcTyConBndrs :: [(TcTyCon, ScopedPairs, TcKind)]
swizzleTcTyConBndrs tc_infos
| all no_swizzle swizzle_prs
-- This fast path happens almost all the time
- -- See Note [Non-cloning for tyvar binders] in TcHsType
+ -- See Note [Non-cloning for tyvar binders] in GHC.Tc.Gen.HsType
= do { traceTc "Skipping swizzleTcTyConBndrs for" (ppr (map fstOf3 tc_infos))
; return tc_infos }
@@ -1064,9 +1063,9 @@ We do kind inference as follows:
These unification variables
- Are TyVarTvs: that is, unification variables that can
unify only with other type variables.
- See Note [Signature skolems] in TcType
+ See Note [Signature skolems] in GHC.Tc.Utils.TcType
- - Have complete fresh Names; see TcMType
+ - Have complete fresh Names; see GHC.Tc.Utils.TcMType
Note [Unification variables need fresh Names]
Assign initial monomorphic kinds to S, T
@@ -1091,7 +1090,7 @@ We do kind inference as follows:
This makes the utterly-final TyConBinders for the TyCon.
- All this is very similar at the level of terms: see TcBinds
+ All this is very similar at the level of terms: see GHC.Tc.Gen.Bind
Note [Quantified variables in partial type signatures]
But there some tricky corners: Note [Tricky scoping in generaliseTcTyCon]
@@ -1109,8 +1108,8 @@ There are some wrinkles
* Do not default TyVarTvs. We always want to kind-generalise over
TyVarTvs, and /not/ default them to Type. By definition a TyVarTv is
not allowed to unify with a type; it must stand for a type
- variable. Hence the check in TcSimplify.defaultTyVarTcS, and
- TcMType.defaultTyVar. Here's another example (#14555):
+ variable. Hence the check in GHC.Tc.Solver.defaultTyVarTcS, and
+ GHC.Tc.Utils.TcMType.defaultTyVar. Here's another example (#14555):
data Exp :: [TYPE rep] -> TYPE rep -> Type where
Lam :: Exp (a:xs) b -> Exp xs (a -> b)
We want to kind-generalise over the 'rep' variable.
@@ -1208,7 +1207,7 @@ testsuite did not show up a single spurious inclusion of this message.
The context is added in addVDQNote, which looks for a visible TyConBinder
that also appears in the TyCon's kind. (I first looked at the kind for
a visible, dependent quantifier, but Note [No polymorphic recursion] in
-TcHsType defeats that approach.) addVDQNote is used in kcTyClDecl,
+GHC.Tc.Gen.HsType defeats that approach.) addVDQNote is used in kcTyClDecl,
which is used only when inferring the kind of a tycon (never with a CUSK or
SAK).
@@ -1705,7 +1704,7 @@ on the kinds and to power unification.
To achieve the use of TyVarTvs, we must be careful to use specialized functions
that produce TyVarTvs, not ordinary skolems. This is why we need
-kcExplicitTKBndrs and kcImplicitTKBndrs in TcHsType, separate from their
+kcExplicitTKBndrs and kcImplicitTKBndrs in GHC.Tc.Gen.HsType, separate from their
tc... variants.
The drawback of this approach is sometimes it will accept a definition that
@@ -1766,10 +1765,10 @@ without looking at T? Delicate answer: during tcTyClDecl, we extend
Then:
- * During TcHsType.tcTyVar we look in the *local* env, to get the
+ * During GHC.Tc.Gen.HsType.tcTyVar we look in the *local* env, to get the
fully-known, not knot-tied TcTyCon for T.
- * Then, in TcHsSyn.zonkTcTypeToType (and zonkTcTyCon in particular)
+ * Then, in GHC.Tc.Utils.Zonk.zonkTcTypeToType (and zonkTcTyCon in particular)
we look in the *global* env to get the TyCon.
This fancy footwork (with two bindings for T) is only necessary for the
@@ -1907,7 +1906,7 @@ There are also some changes for deailng with families:
2. In a newtype instance (with -XUnliftedNewtypes), if the user does
not write a kind signature, we want to allow the possibility that
the kind is not Type, so we use newOpenTypeKind instead of liftedTypeKind.
- This is done in tcDataFamInstHeader in TcInstDcls. Example:
+ This is done in tcDataFamInstHeader in GHC.Tc.TyCl.Instance. Example:
data family Bar (a :: RuntimeRep) :: TYPE a
newtype instance Bar 'IntRep = BarIntC Int#
@@ -2367,7 +2366,7 @@ newtype instance T [a] :: <kind> where ... -- See Point 5
arity only matters for pretty-printing.
See also Note [TyConBinders for the result kind signatures of a data type]
- in TcHsType.
+ in GHC.Tc.Gen.HsType.
4. Datatype return kind restriction: A data/data-instance return kind must end
in a type that, after type-synonym expansion, yields `TYPE LiftedRep`. By
@@ -2452,7 +2451,7 @@ newtype instance T [a] :: <kind> where ... -- See Point 5
one from the family declaration and one from the instance declaration
(see point (2) above), they are unified. More accurately, we make sure
that the kind of the applied data family is a subkind of the user-written
- kind. TcHsType.checkExpectedKind normally does this check for types, but
+ kind. GHC.Tc.Gen.HsType.checkExpectedKind normally does this check for types, but
that's overkill for our needs here. Instead, we just instantiate any
invisible binders in the (instantiated) kind of the data family
(called lhs_kind in tcDataFamInstHeader) with tcInstInvisibleTyBinders
@@ -2568,7 +2567,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info
-- Do not attempt to drop equations dominated by earlier
-- ones here; in the case of mutual recursion with a data
-- type, we get a knot-tying failure. Instead we check
- -- for this afterwards, in TcValidity.checkValidCoAxiom
+ -- for this afterwards, in GHC.Tc.Validity.checkValidCoAxiom
-- Example: tc265
-- Create a CoAxiom, with the correct src location.
@@ -2783,7 +2782,7 @@ kcTyFamInstEqn _ (L _ (HsIB _ (XFamEqn nec))) = noExtCon nec
--------------------------
tcTyFamInstEqn :: TcTyCon -> AssocInstInfo -> LTyFamInstEqn GhcRn
-> TcM (KnotTied CoAxBranch)
--- Needs to be here, not in TcInstDcls, because closed families
+-- Needs to be here, not in GHC.Tc.TyCl.Instance, because closed families
-- (typechecked here) have TyFamInstEqns
tcTyFamInstEqn fam_tc mb_clsinfo
@@ -2875,7 +2874,7 @@ Hence the slightly mysterious call:
Simple, neat, but a little non-obvious!
-See also Note [Re-quantify type variables in rules] in TcRules, which explains
+See also Note [Re-quantify type variables in rules] in GHC.Tc.Gen.Rule, which explains
a very similar design when generalising over the type of a rewrite rule.
-}
@@ -2893,7 +2892,7 @@ tcTyFamInstEqnGuts fam_tc mb_clsinfo imp_vars exp_bndrs hs_pats hs_rhs_ty
-- have checked that the number of patterns matches tyConArity
-- This code is closely related to the code
- -- in TcHsType.kcCheckDeclHeader_cusk
+ -- in GHC.Tc.Gen.HsType.kcCheckDeclHeader_cusk
; (imp_tvs, (exp_tvs, (lhs_ty, rhs_ty)))
<- pushTcLevelM_ $
solveEqualities $
@@ -2948,7 +2947,7 @@ tcFamTyPats fam_tc hs_pats
; (fam_app, res_kind) <- unsetWOptM Opt_WarnPartialTypeSignatures $
setXOptM LangExt.PartialTypeSignatures $
-- See Note [Wildcards in family instances] in
- -- GHC.Rename.Source
+ -- GHC.Rename.Module
tcInferApps typeLevelMode lhs_fun fun_ty hs_pats
; traceTc "End tcFamTyPats }" $
@@ -3894,7 +3893,7 @@ checkValidTyCon tc
get_fields con = dataConFieldLabels con `zip` repeat con
-- dataConFieldLabels may return the empty list, which is fine
- -- See Note [GADT record selectors] in TcTyDecls
+ -- See Note [GADT record selectors] in GHC.Tc.TyCl.Utils
-- We must check (a) that the named field has the same
-- type in each constructor
-- (b) that those constructors have the same result type
@@ -4225,7 +4224,7 @@ checkValidClass cls
-- default op :: forall b. (a~b) => blah
-- we do not want to do an ambiguity check on a type with
-- a free TyVar 'a' (#11608). See TcType
- -- Note [TyVars and TcTyVars during type checking] in TcType
+ -- Note [TyVars and TcTyVars during type checking] in GHC.Tc.Utils.TcType
-- Hence the mkDefaultMethodType to close the type.
check_dm ctxt sel_id vanilla_cls_pred vanilla_tau
(Just (dm_name, dm_spec@(GenericDM dm_ty)))
@@ -4389,7 +4388,7 @@ As noted in #12918, there are several reasons to do this:
confusing error messages.
2. Internally, GHC uses TypeApplications to instantiate the default method in
- an instance. See Note [Default methods in instances] in TcInstDcls.
+ an instance. See Note [Default methods in instances] in GHC.Tc.TyCl.Instance.
Thus, GHC needs to know exactly what the universally quantified type
variables are, and when instantiated that way, the default method's type
must match the expected type.
@@ -4552,7 +4551,7 @@ checkRoleAnnot tv (L _ (Just r1)) r2
addErrTc $ badRoleAnnot (tyVarName tv) r1 r2
-- This is a double-check on the role inference algorithm. It is only run when
--- -dcore-lint is enabled. See Note [Role inference] in TcTyDecls
+-- -dcore-lint is enabled. See Note [Role inference] in GHC.Tc.TyCl.Utils
checkValidRoles :: TyCon -> TcM ()
-- If you edit this function, you may need to update the GHC formalism
-- See Note [GHC Formalism] in GHC.Core.Lint
@@ -4569,7 +4568,7 @@ checkValidRoles tc
= do { traceTc "check_dc_roles" (ppr datacon <+> ppr (tyConRoles tc))
; mapM_ (check_ty_roles role_env Representational) $
eqSpecPreds eq_spec ++ theta ++ arg_tys }
- -- See Note [Role-checking data constructor arguments] in TcTyDecls
+ -- See Note [Role-checking data constructor arguments] in GHC.Tc.TyCl.Utils
where
(univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _res_ty)
= dataConFullSig datacon
@@ -4862,7 +4861,7 @@ wrongKindOfFamily family
-- | Produce an error for oversaturated type family equations with too many
-- required arguments.
--- See Note [Oversaturated type family equations] in TcValidity.
+-- See Note [Oversaturated type family equations] in GHC.Tc.Validity.
wrongNumberOfParmsErr :: Arity -> SDoc
wrongNumberOfParmsErr max_args
= text "Number of parameters must match family declaration; expected"
diff --git a/compiler/iface/BuildTyCl.hs b/compiler/GHC/Tc/TyCl/Build.hs
index e66c1e6fb6..a118630fda 100644
--- a/compiler/iface/BuildTyCl.hs
+++ b/compiler/GHC/Tc/TyCl/Build.hs
@@ -7,7 +7,7 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module BuildTyCl (
+module GHC.Tc.TyCl.Build (
buildDataCon,
buildPatSyn,
TcMethInfo, MethInfo, buildClass,
@@ -35,11 +35,11 @@ import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Core.Type
import GHC.Types.Id
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Types.SrcLoc( SrcSpan, noSrcSpan )
import GHC.Driver.Session
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import GHC.Types.Unique.Supply
import Util
import Outputable
@@ -386,7 +386,7 @@ are boxed.
newImplicitBinder :: Name -- Base name
-> (OccName -> OccName) -- Occurrence name modifier
-> TcRnIf m n Name -- Implicit name
--- Called in BuildTyCl to allocate the implicit binders of type/class decls
+-- Called in GHC.Tc.TyCl.Build to allocate the implicit binders of type/class decls
-- For source type/class decls, this is the first occurrence
-- For iface ones, GHC.Iface.Load has already allocated a suitable name in the cache
newImplicitBinder base_name mk_sys_occ
diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/GHC/Tc/TyCl/Class.hs
index c705902a10..55105f84ff 100644
--- a/compiler/typecheck/TcClassDcl.hs
+++ b/compiler/GHC/Tc/TyCl/Class.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Typechecking class declarations
-}
{-# LANGUAGE CPP #-}
@@ -11,38 +9,46 @@ Typechecking class declarations
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcClassDcl ( tcClassSigs, tcClassDecl2,
- findMethodBind, instantiateMethod,
- tcClassMinimalDef,
- HsSigFun, mkHsSigFun,
- badMethodErr,
- instDeclCtxt1, instDeclCtxt2, instDeclCtxt3,
- tcATDefault
- ) where
+-- | Typechecking class declarations
+module GHC.Tc.TyCl.Class
+ ( tcClassSigs
+ , tcClassDecl2
+ , findMethodBind
+ , instantiateMethod
+ , tcClassMinimalDef
+ , HsSigFun
+ , mkHsSigFun
+ , badMethodErr
+ , instDeclCtxt1
+ , instDeclCtxt2
+ , instDeclCtxt3
+ , tcATDefault
+ )
+where
#include "HsVersions.h"
import GhcPrelude
import GHC.Hs
-import TcEnv
-import TcSigs
-import TcEvidence ( idHsWrapper )
-import TcBinds
-import TcUnify
-import TcHsType
-import TcMType
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.Sig
+import GHC.Tc.Types.Evidence ( idHsWrapper )
+import GHC.Tc.Gen.Bind
+import GHC.Tc.Utils.Unify
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Utils.TcMType
import GHC.Core.Type ( piResultTys )
import GHC.Core.Predicate
-import TcOrigin
-import TcType
-import TcRnMonad
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Utils.Monad
import GHC.Driver.Phases (HscSource(..))
-import BuildTyCl( TcMethInfo )
+import GHC.Tc.TyCl.Build( TcMethInfo )
import GHC.Core.Class
import GHC.Core.Coercion ( pprCoAxiom )
import GHC.Driver.Session
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
import GHC.Types.Id
import GHC.Types.Name
@@ -405,7 +411,7 @@ whose type is
op :: forall c. Foo c => forall b. Ord b => [c] -> b -> b -> b
So tcPolyBinds must be capable of dealing with nested polytypes;
-and so it is. See TcBinds.tcMonoBinds (with type-sig case).
+and so it is. See GHC.Tc.Gen.Bind.tcMonoBinds (with type-sig case).
Note [Silly default-method bind]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index 40bc3853d5..84278082e3 100644
--- a/compiler/typecheck/TcInstDcls.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-TcInstDecls: Typechecking instance declarations
-}
{-# LANGUAGE CPP #-}
@@ -13,42 +11,48 @@ TcInstDecls: Typechecking instance declarations
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcInstDcls ( tcInstDecls1, tcInstDeclsDeriv, tcInstDecls2 ) where
+-- | Typechecking instance declarations
+module GHC.Tc.TyCl.Instance
+ ( tcInstDecls1
+ , tcInstDeclsDeriv
+ , tcInstDecls2
+ )
+where
#include "HsVersions.h"
import GhcPrelude
import GHC.Hs
-import TcBinds
-import TcTyClsDecls
-import TcTyDecls ( addTyConsToGblEnv )
-import TcClassDcl( tcClassDecl2, tcATDefault,
- HsSigFun, mkHsSigFun, badMethodErr,
- findMethodBind, instantiateMethod )
-import TcSigs
-import TcRnMonad
-import TcValidity
-import TcHsSyn
-import TcMType
-import TcType
-import Constraint
-import TcOrigin
-import BuildTyCl
-import Inst
-import ClsInst( AssocInstInfo(..), isNotAssociated )
+import GHC.Tc.Gen.Bind
+import GHC.Tc.TyCl
+import GHC.Tc.TyCl.Utils ( addTyConsToGblEnv )
+import GHC.Tc.TyCl.Class ( tcClassDecl2, tcATDefault,
+ HsSigFun, mkHsSigFun, badMethodErr,
+ findMethodBind, instantiateMethod )
+import GHC.Tc.Gen.Sig
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Validity
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Origin
+import GHC.Tc.TyCl.Build
+import GHC.Tc.Utils.Instantiate
+import GHC.Tc.Instance.Class( AssocInstInfo(..), isNotAssociated )
import GHC.Core.InstEnv
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Core.FamInstEnv
-import TcDeriv
-import TcEnv
-import TcHsType
-import TcUnify
+import GHC.Tc.Deriv
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.HsType
+import GHC.Tc.Utils.Unify
import GHC.Core ( Expr(..), mkApps, mkVarApps, mkLams )
import GHC.Core.Make ( nO_METHOD_BINDING_ERROR_ID )
import GHC.Core.Unfold ( mkInlineUnfoldingWithArity, mkDFunUnfolding )
import GHC.Core.Type
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core.TyCon
import GHC.Core.Coercion.Axiom
import GHC.Core.DataCon
@@ -689,7 +693,7 @@ tcDataFamInstDecl mb_clsinfo
-- we did it before the "extra" tvs from etaExpandAlgTyCon
-- would always be eta-reduced
--
- -- See also Note [Datatype return kinds] in TcTyClsDecls
+ -- See also Note [Datatype return kinds] in GHC.Tc.TyCl
; (extra_tcbs, final_res_kind) <- etaExpandAlgTyCon full_tcbs res_kind
; checkDataKindSig (DataInstanceSort new_or_data) final_res_kind
; let extra_pats = map (mkTyVarTy . binderVar) extra_tcbs
@@ -817,7 +821,7 @@ tcDataFamInstHeader mb_clsinfo fam_tc imp_vars mb_bndrs fixity
-- Add constraints from the data constructors
; kcConDecls new_or_data res_kind hs_cons
- -- See Note [Datatype return kinds] in TcTyClsDecls, point (7).
+ -- See Note [Datatype return kinds] in GHC.Tc.TyCl, point (7).
; (lhs_extra_args, lhs_applied_kind)
<- tcInstInvisibleTyBinders (invisibleTyBndrCount lhs_kind)
lhs_kind
@@ -829,7 +833,7 @@ tcDataFamInstHeader mb_clsinfo fam_tc imp_vars mb_bndrs fixity
, lhs_applied_ty
, lhs_applied_kind ) }
- -- See TcTyClsDecls Note [Generalising in tcFamTyPatsGuts]
+ -- See GHC.Tc.TyCl Note [Generalising in tcFamTyPatsGuts]
-- This code (and the stuff immediately above) is very similar
-- to that in tcTyFamInstEqnGuts. Maybe we should abstract the
-- common code; but for the moment I concluded that it's
@@ -857,7 +861,7 @@ tcDataFamInstHeader mb_clsinfo fam_tc imp_vars mb_bndrs fixity
data_ctxt = DataKindCtxt fam_name
exp_bndrs = mb_bndrs `orElse` []
- -- See Note [Implementation of UnliftedNewtypes] in TcTyClsDecls, wrinkle (2).
+ -- See Note [Implementation of UnliftedNewtypes] in GHC.Tc.TyCl, wrinkle (2).
tc_kind_sig Nothing
= do { unlifted_newtypes <- xoptM LangExt.UnliftedNewtypes
; if unlifted_newtypes && new_or_data == NewType
@@ -884,7 +888,7 @@ The expected type might have a forall at the type. Normally, we
can't skolemise in kinds because we don't have type-level lambda.
But here, we're at the top-level of an instance declaration, so
we actually have a place to put the regeneralised variables.
-Thus: skolemise away. cf. Inst.deeplySkolemise and TcUnify.tcSkolemise
+Thus: skolemise away. cf. Inst.deeplySkolemise and GHC.Tc.Utils.Unify.tcSkolemise
Examples in indexed-types/should_compile/T12369
Note [Implementing eta reduction for data families]
@@ -923,7 +927,7 @@ however, so this Note aims to describe these subtleties:
data instance header only supplies three. But the AlgTyCon for Drep
itself must have enough TyConBinders so that its result kind is Type.
So, with etaExpandAlgTyCon we make up some extra TyConBinders.
- See point (3) in Note [Datatype return kinds] in TcTyClsDecls.
+ See point (3) in Note [Datatype return kinds] in GHC.Tc.TyCl.
* The result kind in the instance might be a polykind, like this:
data family DP a :: forall k. k -> *
@@ -997,7 +1001,7 @@ tcInstDecls2 tycl_decls inst_decls
-- (b) instance declarations
; let dm_ids = collectHsBindsBinders dm_binds
-- Add the default method Ids (again)
- -- (they were arready added in TcTyDecls.tcAddImplicits)
+ -- (they were arready added in GHC.Tc.TyCl.Utils.tcAddImplicits)
-- See Note [Default methods in the type environment]
; inst_binds_s <- tcExtendGlobalValEnv dm_ids $
mapM tcInstDecl2 inst_decls
@@ -1202,7 +1206,7 @@ Notice that
implication for the whole instance declaration, with the expected
skolems and givens. We need this to get the correct "redundant
constraint" warnings, gathering all the uses from all the methods
- and superclasses. See TcSimplify Note [Tracking redundant
+ and superclasses. See GHC.Tc.Solver Note [Tracking redundant
constraints]
* The given constraints in the outer implication may generate
@@ -1346,7 +1350,7 @@ generate a guaranteed-non-bottom superclass witness from:
(sc3) a call of a dfun (always returns a dictionary constructor)
The tricky case is (sc2). We proceed by induction on the size of
-the (type of) the dictionary, defined by TcValidity.sizeTypes.
+the (type of) the dictionary, defined by GHC.Tc.Validity.sizeTypes.
Let's suppose we are building a dictionary of size 3, and
suppose the Superclass Invariant holds of smaller dictionaries.
Then if we have a smaller dictionary, its immediate superclasses
@@ -1407,7 +1411,7 @@ Answer:
* (sc2) ScOrigin wanted constraints can't be solved from a
superclass selection, except at a smaller type. This test is
- implemented by TcInteract.prohibitedSuperClassSolve
+ implemented by GHC.Tc.Solver.Interact.prohibitedSuperClassSolve
* The "given" constraints of an instance decl have CtOrigin
GivenOrigin InstSkol.
@@ -1416,7 +1420,7 @@ Answer:
a SkolemInfo of (InstSC size), where 'size' is the size of
the constraint whose superclass we are taking. A similarly
when taking the superclass of an InstSC. This is implemented
- in TcCanonical.newSCWorkFromFlavored
+ in GHC.Tc.Solver.Canonical.newSCWorkFromFlavored
Note [Silent superclass arguments] (historical interest only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1866,7 +1870,7 @@ mk_meth_spec_prags :: Id -> [LTcSpecPrag] -> [LTcSpecPrag] -> TcSpecPrags
-- * spec_prags_from_inst: derived from {-# SPECIALISE instance :: <blah> #-}
-- These ones have the dfun inside, but [perhaps surprisingly]
-- the correct wrapper.
- -- See Note [Handling SPECIALISE pragmas] in TcBinds
+ -- See Note [Handling SPECIALISE pragmas] in GHC.Tc.Gen.Bind
mk_meth_spec_prags meth_id spec_inst_prags spec_prags_for_me
= SpecPrags (spec_prags_for_me ++ spec_prags_from_inst)
where
diff --git a/compiler/typecheck/TcInstDcls.hs-boot b/compiler/GHC/Tc/TyCl/Instance.hs-boot
index c65016efa0..1e47211460 100644
--- a/compiler/typecheck/TcInstDcls.hs-boot
+++ b/compiler/GHC/Tc/TyCl/Instance.hs-boot
@@ -3,14 +3,14 @@
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
-module TcInstDcls ( tcInstDecls1 ) where
+module GHC.Tc.TyCl.Instance ( tcInstDecls1 ) where
import GHC.Hs
-import TcRnTypes
-import TcEnv( InstInfo )
-import TcDeriv
+import GHC.Tc.Types
+import GHC.Tc.Utils.Env( InstInfo )
+import GHC.Tc.Deriv
-- We need this because of the mutual recursion
--- between TcTyClsDecls and TcInstDcls
+-- between GHC.Tc.TyCl and GHC.Tc.TyCl.Instance
tcInstDecls1 :: [LInstDecl GhcRn]
-> TcM (TcGblEnv, [InstInfo GhcRn], [DerivInfo])
diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/GHC/Tc/TyCl/PatSyn.hs
index 4114eeca58..01b446c88b 100644
--- a/compiler/typecheck/TcPatSyn.hs
+++ b/compiler/GHC/Tc/TyCl/PatSyn.hs
@@ -2,7 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcPatSyn]{Typechecking pattern synonym declarations}
-}
{-# LANGUAGE CPP #-}
@@ -12,20 +11,25 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcPatSyn ( tcPatSynDecl, tcPatSynBuilderBind
- , tcPatSynBuilderOcc, nonBidirectionalErr
- ) where
+-- | Typechecking pattern synonym declarations
+module GHC.Tc.TyCl.PatSyn
+ ( tcPatSynDecl
+ , tcPatSynBuilderBind
+ , tcPatSynBuilderOcc
+ , nonBidirectionalErr
+ )
+where
import GhcPrelude
import GHC.Hs
-import TcPat
+import GHC.Tc.Gen.Pat
import GHC.Core.Type ( tidyTyCoVarBinders, tidyTypes, tidyType )
-import TcRnMonad
-import TcSigs( emptyPragEnv, completeSigFromId )
-import TcEnv
-import TcMType
-import TcHsSyn
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Gen.Sig( emptyPragEnv, completeSigFromId )
+import GHC.Tc.Utils.Env
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.Zonk
import TysPrim
import GHC.Types.Name
import GHC.Types.SrcLoc
@@ -38,19 +42,19 @@ import GHC.Types.Var
import GHC.Types.Var.Env( emptyTidyEnv, mkInScopeSet )
import GHC.Types.Id
import GHC.Types.Id.Info( RecSelParent(..), setLevityInfoWithType )
-import TcBinds
+import GHC.Tc.Gen.Bind
import GHC.Types.Basic
-import TcSimplify
-import TcUnify
+import GHC.Tc.Solver
+import GHC.Tc.Utils.Unify
import GHC.Core.Predicate
import TysWiredIn
-import TcType
-import TcEvidence
-import TcOrigin
-import BuildTyCl
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Origin
+import GHC.Tc.TyCl.Build
import GHC.Types.Var.Set
import GHC.Types.Id.Make
-import TcTyDecls
+import GHC.Tc.TyCl.Utils
import GHC.Core.ConLike
import GHC.Types.FieldLabel
import Bag
@@ -262,7 +266,7 @@ mentions the existentials. We can conveniently do that by making the
"taus" passed to simplifyInfer look like
forall ex_tvs. arg_ty
-After that, Note [Naughty quantification candidates] in TcMType takes
+After that, Note [Naughty quantification candidates] in GHC.Tc.Utils.TcMType takes
over and errors.
Note [Remove redundant provided dicts]
@@ -309,7 +313,7 @@ and is not implicitly instantiated.
So in mkProvEvidence we lift (a ~# b) to (a ~ b). Tiresome, and
marginally less efficient, if the builder/martcher are not inlined.
-See also Note [Lift equality constraints when quantifying] in TcType
+See also Note [Lift equality constraints when quantifying] in GHC.Tc.Utils.TcType
Note [Coercions that escape]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -371,7 +375,7 @@ tcCheckPatSynDecl psb@PSB{ psb_id = lname@(L _ name), psb_args = details
2 (text "mentions existential type variable" <> plural bad_tvs
<+> pprQuotedList bad_tvs)
- -- See Note [The pattern-synonym signature splitting rule] in TcSigs
+ -- See Note [The pattern-synonym signature splitting rule] in GHC.Tc.Gen.Sig
; let univ_fvs = closeOverKinds $
(tyCoVarsOfTypes (pat_ty : req_theta) `extendVarSetList` explicit_univ_tvs)
(extra_univ, extra_ex) = partition ((`elemVarSet` univ_fvs) . binderVar) implicit_tvs
diff --git a/compiler/typecheck/TcPatSyn.hs-boot b/compiler/GHC/Tc/TyCl/PatSyn.hs-boot
index 950d03811a..44be72781d 100644
--- a/compiler/typecheck/TcPatSyn.hs-boot
+++ b/compiler/GHC/Tc/TyCl/PatSyn.hs-boot
@@ -1,8 +1,8 @@
-module TcPatSyn where
+module GHC.Tc.TyCl.PatSyn where
import GHC.Hs ( PatSynBind, LHsBinds )
-import TcRnTypes ( TcM, TcSigInfo )
-import TcRnMonad ( TcGblEnv)
+import GHC.Tc.Types ( TcM, TcSigInfo )
+import GHC.Tc.Utils.Monad ( TcGblEnv)
import Outputable ( Outputable )
import GHC.Hs.Extension ( GhcRn, GhcTc )
import Data.Maybe ( Maybe )
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/GHC/Tc/TyCl/Utils.hs
index cff4f3ed00..80157caa0d 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/GHC/Tc/TyCl/Utils.hs
@@ -2,11 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1999
-
-Analysis functions over data types. Specifically, detecting recursive types.
-
-This stuff is only used for source-code decls; it's recorded in interface
-files for imported data types.
-}
{-# LANGUAGE CPP #-}
@@ -16,7 +11,11 @@ files for imported data types.
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcTyDecls(
+-- | Analysis functions over data types. Specifically, detecting recursive types.
+--
+-- This stuff is only used for source-code decls; it's recorded in interface
+-- files for imported data types.
+module GHC.Tc.TyCl.Utils(
RolesInfo,
inferRoles,
checkSynCycles,
@@ -33,11 +32,11 @@ module TcTyDecls(
import GhcPrelude
-import TcRnMonad
-import TcEnv
-import TcBinds( tcValBinds )
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env
+import GHC.Tc.Gen.Bind( tcValBinds )
import GHC.Core.TyCo.Rep( Type(..), Coercion(..), MCoercion(..), UnivCoProvenance(..) )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Predicate
import TysWiredIn( unitTy )
import GHC.Core.Make( rEC_SEL_ERROR_ID )
@@ -790,7 +789,7 @@ mkDefaultMethodType cls _ (GenericDM dm_ty) = mkSigmaTy tv_bndrs [pred] dm_ty
-- TyCon to get those. We /do/ need the TyConBinders because
-- we need the correct visibility: these default methods are
-- used in code generated by the fill-in for missing
- -- methods in instances (TcInstDcls.mkDefMethBind), and
+ -- methods in instances (GHC.Tc.TyCl.Instance.mkDefMethBind), and
-- then typechecked. So we need the right visibility info
-- (#13998)
@@ -980,7 +979,7 @@ sel_naughty field.
Note [GADT record selectors]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For GADTs, we require that all constructors with a common field 'f' have the same
-result type (modulo alpha conversion). [Checked in TcTyClsDecls.checkValidTyCon]
+result type (modulo alpha conversion). [Checked in GHC.Tc.TyCl.checkValidTyCon]
E.g.
data T where
T1 { f :: Maybe a } :: T [a]
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/GHC/Tc/Types.hs
index aa3c0412ee..dcf6fc94b6 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/GHC/Tc/Types.hs
@@ -2,24 +2,24 @@
(c) The University of Glasgow 2006-2012
(c) The GRASP Project, Glasgow University, 1992-2002
-
-Various types used during typechecking, please see TcRnMonad as well for
-operations on these types. You probably want to import it, instead of this
-module.
-
-All the monads exported here are built on top of the same IOEnv monad. The
-monad functions like a Reader monad in the way it passes the environment
-around. This is done to allow the environment to be manipulated in a stack
-like fashion when entering expressions... etc.
-
-For state that is global and should be returned at the end (e.g not part
-of the stack mechanism), you should use a TcRef (= IORef) to store them.
-}
{-# LANGUAGE CPP, DeriveFunctor, ExistentialQuantification, GeneralizedNewtypeDeriving,
ViewPatterns #-}
-module TcRnTypes(
+-- | Various types used during typechecking.
+--
+-- Please see GHC.Tc.Utils.Monad as well for operations on these types. You probably
+-- want to import it, instead of this module.
+--
+-- All the monads exported here are built on top of the same IOEnv monad. The
+-- monad functions like a Reader monad in the way it passes the environment
+-- around. This is done to allow the environment to be manipulated in a stack
+-- like fashion when entering expressions... etc.
+--
+-- For state that is global and should be returned at the end (e.g not part
+-- of the stack mechanism), you should use a TcRef (= IORef) to store them.
+module GHC.Tc.Types(
TcRnIf, TcRn, TcM, RnM, IfM, IfL, IfG, -- The monad is opaque outside this module
TcRef,
@@ -87,15 +87,15 @@ import GhcPrelude
import GHC.Hs
import GHC.Driver.Types
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Core.Type
import GHC.Core.TyCon ( TyCon, tyConKind )
import GHC.Core.PatSyn ( PatSyn )
import GHC.Types.Id ( idType, idName )
import GHC.Types.FieldLabel ( FieldLabel )
-import TcType
-import Constraint
-import TcOrigin
+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
@@ -135,7 +135,7 @@ import Data.Maybe ( mapMaybe )
import GHCi.Message
import GHCi.RemoteTypes
-import {-# SOURCE #-} TcHoleFitTypes ( HoleFitPlugin )
+import {-# SOURCE #-} GHC.Tc.Errors.Hole.FitTypes ( HoleFitPlugin )
import qualified Language.Haskell.TH as TH
@@ -171,7 +171,7 @@ data NameShape = NameShape {
************************************************************************
* *
Standard monad definition for TcRn
- All the combinators for the monad can be found in TcRnMonad
+ All the combinators for the monad can be found in GHC.Tc.Utils.Monad
* *
************************************************************************
@@ -383,7 +383,7 @@ data FrontendResult
--
-- - For any code involving Names, we want semantic modules.
-- See lookupIfaceTop in GHC.Iface.Env, mkIface and addFingerprints
--- in GHC.Iface.{Make,Recomp}, and tcLookupGlobal in TcEnv
+-- in GHC.Iface.{Make,Recomp}, and tcLookupGlobal in GHC.Tc.Utils.Env
--
-- - When reading interfaces, we want the identity module to
-- identify the specific interface we want (such interfaces
@@ -647,7 +647,7 @@ data SelfBootInfo
{ sb_mds :: ModDetails -- There was a hi-boot file,
, sb_tcs :: NameSet } -- defining these TyCons,
-- What is sb_tcs used for? See Note [Extra dependencies from .hs-boot files]
--- in GHC.Rename.Source
+-- in GHC.Rename.Module
{- Note [Tracking unused binding and imports]
@@ -801,7 +801,7 @@ type ErrCtxt = (Bool, TidyEnv -> TcM (TidyEnv, MsgDoc))
-- discard it when trimming for display
-- These are here to avoid module loops: one might expect them
--- in Constraint, but they refer to ErrCtxt which refers to TcM.
+-- in GHC.Tc.Types.Constraint, but they refer to ErrCtxt which refers to TcM.
-- Easier to just keep these definitions here, alongside TcM.
pushErrCtxt :: CtOrigin -> ErrCtxt -> CtLoc -> CtLoc
pushErrCtxt o err loc@(CtLoc { ctl_env = lcl })
@@ -821,7 +821,7 @@ type ThBindEnv = NameEnv (TopLevelFlag, ThLevel)
-- cross-stage at arbitrary types if the Id is bound at top level.
--
-- Nota bene: a ThLevel of 'outerLevel' is *not* the same as being
- -- bound at top level! See Note [Template Haskell levels] in TcSplice
+ -- bound at top level! See Note [Template Haskell levels] in GHC.Tc.Gen.Splice
{- Note [Given Insts]
~~~~~~~~~~~~~~~~~~
@@ -909,7 +909,7 @@ removeBindingShadowing bindings = reverse $ fst $ foldl
data SpliceType = Typed | Untyped
data ThStage -- See Note [Template Haskell state diagram]
- -- and Note [Template Haskell levels] in TcSplice
+ -- and Note [Template Haskell levels] in GHC.Tc.Gen.Splice
-- Start at: Comp
-- At bracket: wrap current stage in Brack
-- At splice: currently Brack: return to previous stage
@@ -932,7 +932,7 @@ data ThStage -- See Note [Template Haskell state diagram]
-- For typed splices, the typechecker takes finalizers from here and
-- inserts them in the list of finalizers in the global environment.
--
- -- See Note [Collecting modFinalizers in typed splices] in "TcSplice".
+ -- See Note [Collecting modFinalizers in typed splices] in "GHC.Tc.Gen.Splice".
| Comp -- Ordinary Haskell code
-- Binding level = 1
@@ -970,7 +970,7 @@ instance Outputable ThStage where
ppr (Brack s _) = text "Brack" <> parens (ppr s)
type ThLevel = Int
- -- NB: see Note [Template Haskell levels] in TcSplice
+ -- NB: see Note [Template Haskell levels] in GHC.Tc.Gen.Splice
-- Incremented when going inside a bracket,
-- decremented when going inside a splice
-- NB: ThLevel is one greater than the 'n' in Fig 2 of the
@@ -1048,7 +1048,7 @@ data ArrowCtxt -- Note [Escaping the arrow scope]
-- | A typecheckable thing available in a local context. Could be
-- 'AGlobal' 'TyThing', but also lexically scoped variables, etc.
--- See 'TcEnv' for how to retrieve a 'TyThing' given a 'Name'.
+-- See 'GHC.Tc.Utils.Env' for how to retrieve a 'TyThing' given a 'Name'.
data TcTyThing
= AGlobal TyThing -- Used only in the return type of a lookup
@@ -1074,16 +1074,16 @@ data PromotionErr
| FamDataConPE -- Data constructor for a data family
-- See Note [AFamDataCon: not promoting data family constructors]
- -- in TcEnv.
+ -- in GHC.Tc.Utils.Env.
| ConstrainedDataConPE PredType
-- Data constructor with a non-equality context
-- See Note [Don't promote data constructors with
- -- non-equality contexts] in TcHsType
+ -- non-equality contexts] in GHC.Tc.Gen.HsType
| PatSynPE -- Pattern synonyms
- -- See Note [Don't promote pattern synonyms] in TcEnv
+ -- See Note [Don't promote pattern synonyms] in GHC.Tc.Utils.Env
| RecDataConPE -- Data constructor in a recursive loop
- -- See Note [Recursion and promoting data constructors] in TcTyClsDecls
+ -- See Note [Recursion and promoting data constructors] in GHC.Tc.TyCl
| NoDataKindsTC -- -XDataKinds not enabled (for a tycon)
| NoDataKindsDC -- -XDataKinds not enabled (for a datacon)
@@ -1101,9 +1101,9 @@ instance Outputable TcTyThing where -- Debugging only
-- | IdBindingInfo describes how an Id is bound.
--
-- It is used for the following purposes:
--- a) for static forms in TcExpr.checkClosedInStaticForm and
+-- a) for static forms in GHC.Tc.Gen.Expr.checkClosedInStaticForm and
-- b) to figure out when a nested binding can be generalised,
--- in TcBinds.decideGeneralisationPlan.
+-- in GHC.Tc.Gen.Bind.decideGeneralisationPlan.
--
data IdBindingInfo -- See Note [Meaning of IdBindingInfo and ClosedTypeId]
= NotLetBound
@@ -1161,7 +1161,7 @@ that x's binding is floatable to the top level. Specifically:
* x's RhsNames must be empty
* x's type has no free variables
See Note [Grand plan for static forms] in StaticPtrTable.hs.
-This test is made in TcExpr.checkClosedInStaticForm.
+This test is made in GHC.Tc.Gen.Expr.checkClosedInStaticForm.
Actually knowing x's RhsNames (rather than just its emptiness
or otherwise) is just so we can produce better error messages
@@ -1457,7 +1457,7 @@ instance Outputable WhereFrom where
********************************************************************* -}
-- These data types need to be here only because
--- TcSimplify uses them, and TcSimplify is fairly
+-- GHC.Tc.Solver uses them, and GHC.Tc.Solver is fairly
-- low down in the module hierarchy
type TcSigFun = Name -> Maybe TcSigInfo
@@ -1516,7 +1516,7 @@ data TcIdSigInst
-- the type and hence have a different unique.
-- No need to keep track of whether they are truly lexically
-- scoped because the renamer has named them uniquely
- -- See Note [Binding scoped type variables] in TcSigs
+ -- See Note [Binding scoped type variables] in GHC.Tc.Gen.Sig
--
-- NB: The order of sig_inst_skols is irrelevant
-- for a CompleteSig, but for a PartialSig see
@@ -1540,7 +1540,7 @@ data TcIdSigInst
-- Extra-constraints wildcard to fill in, if any
-- If this exists, it is surely of the form (meta_tv |> co)
-- (where the co might be reflexive). This is filled in
- -- only from the return value of TcHsType.tcAnonWildCardOcc
+ -- only from the return value of GHC.Tc.Gen.HsType.tcAnonWildCardOcc
}
{- Note [sig_inst_tau may be polymorphic]
@@ -1549,7 +1549,7 @@ Note that "sig_inst_tau" might actually be a polymorphic type,
if the original function had a signature like
forall a. Eq a => forall b. Ord b => ....
But that's ok: tcMatchesFun (called by tcRhs) can deal with that
-It happens, too! See Note [Polymorphic methods] in TcClassDcl.
+It happens, too! See Note [Polymorphic methods] in GHC.Tc.TyCl.Class.
Note [Quantified variables in partial type signatures]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1597,7 +1597,7 @@ data TcPatSynInfo
patsig_name :: Name,
patsig_implicit_bndrs :: [TyVarBinder], -- Implicitly-bound kind vars (Inferred) and
-- implicitly-bound type vars (Specified)
- -- See Note [The pattern-synonym signature splitting rule] in TcPatSyn
+ -- See Note [The pattern-synonym signature splitting rule] in GHC.Tc.TyCl.PatSyn
patsig_univ_bndrs :: [TyVar], -- Bound by explicit user forall
patsig_req :: TcThetaType,
patsig_ex_bndrs :: [TyVar], -- Bound by explicit user forall
diff --git a/compiler/typecheck/TcRnTypes.hs-boot b/compiler/GHC/Tc/Types.hs-boot
index bd7bf07a47..8b8feac31e 100644
--- a/compiler/typecheck/TcRnTypes.hs-boot
+++ b/compiler/GHC/Tc/Types.hs-boot
@@ -1,6 +1,6 @@
-module TcRnTypes where
+module GHC.Tc.Types where
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Types.SrcLoc
data TcLclEnv
diff --git a/compiler/typecheck/Constraint.hs b/compiler/GHC/Tc/Types/Constraint.hs
index 1ca3d4b405..3f85594c97 100644
--- a/compiler/typecheck/Constraint.hs
+++ b/compiler/GHC/Tc/Types/Constraint.hs
@@ -1,15 +1,10 @@
-{-
-
-This module defines types and simple operations over constraints,
-as used in the type-checker and constraint solver.
-
--}
-
{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module Constraint (
+-- | This module defines types and simple operations over constraints, as used
+-- in the type-checker and constraint solver.
+module GHC.Tc.Types.Constraint (
-- QCInst
QCInst(..), isPendingScInst,
@@ -77,8 +72,8 @@ module Constraint (
import GhcPrelude
-import {-# SOURCE #-} TcRnTypes ( TcLclEnv, setLclEnvTcLevel, getLclEnvTcLevel
- , setLclEnvLoc, getLclEnvLoc )
+import {-# SOURCE #-} GHC.Tc.Types ( TcLclEnv, setLclEnvTcLevel, getLclEnvTcLevel
+ , setLclEnvLoc, getLclEnvLoc )
import GHC.Core.Predicate
import GHC.Core.Type
@@ -87,9 +82,9 @@ import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Types.Var
-import TcType
-import TcEvidence
-import TcOrigin
+import GHC.Tc.Utils.TcType
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Origin
import GHC.Core
@@ -124,7 +119,7 @@ import Control.Monad ( msum )
-- (ii) Note that xi types can contain unexpanded type synonyms;
-- however, the (transitive) expansions of those type synonyms
-- will not contain any type functions, unless we are under a ForAll.
--- We enforce the structure of Xi types when we flatten (TcCanonical)
+-- We enforce the structure of Xi types when we flatten (GHC.Tc.Solver.Canonical)
type Xi = Type -- In many comments, "xi" ranges over Xi
@@ -138,7 +133,7 @@ data Ct
cc_class :: Class,
cc_tyargs :: [Xi], -- cc_tyargs are function-free, hence Xi
- cc_pend_sc :: Bool -- See Note [The superclass story] in TcCanonical
+ cc_pend_sc :: Bool -- See Note [The superclass story] in GHC.Tc.Solver.Canonical
-- True <=> (a) cc_class has superclasses
-- (b) we have not (yet) added those
-- superclasses as Givens
@@ -161,7 +156,7 @@ data Ct
| CTyEqCan { -- tv ~ rhs
-- Invariants:
- -- * See Note [inert_eqs: the inert equalities] in TcSMonad
+ -- * See Note [inert_eqs: the inert equalities] in GHC.Tc.Solver.Monad
-- * (TyEq:OC) tv not in deep tvs(rhs) (occurs check)
-- * (TyEq:F) If tv is a TauTv, then rhs has no foralls
-- (this avoids substituting a forall for the tyvar in other types)
@@ -170,7 +165,7 @@ data Ct
-- See Note [Almost function-free]
-- * (TyEq:N) If the equality is representational, rhs has no top-level newtype
-- See Note [No top-level newtypes on RHS of representational
- -- equalities] in TcCanonical
+ -- equalities] in GHC.Tc.Solver.Canonical
-- * (TyEq:TV) If rhs (perhaps under the cast) is also a tv, then it is oriented
-- to give best chance of
-- unification happening; eg if rhs is touchable then lhs is too
@@ -200,10 +195,10 @@ data Ct
cc_fsk :: TcTyVar -- [G] always a FlatSkolTv
-- [W], [WD], or [D] always a FlatMetaTv
- -- See Note [The flattening story] in TcFlatten
+ -- See Note [The flattening story] in GHC.Tc.Solver.Flatten
}
- | CNonCanonical { -- See Note [NonCanonical Semantics] in TcSMonad
+ | CNonCanonical { -- See Note [NonCanonical Semantics] in GHC.Tc.Solver.Monad
cc_ev :: CtEvidence
}
@@ -222,7 +217,7 @@ data Ct
------------
data QCInst -- A much simplified version of ClsInst
- -- See Note [Quantified constraints] in TcCanonical
+ -- See Note [Quantified constraints] in GHC.Tc.Solver.Canonical
= QCI { qci_ev :: CtEvidence -- Always of type forall tvs. context => ty
-- Always Given
, qci_tvs :: [TcTyVar] -- The tvs
@@ -292,7 +287,7 @@ If ct :: Ct, then extra fields of 'ct' cache precisely the ctev_pred field
of (cc_ev ct), and is fully rewritten wrt the substitution. Eg for CDictCan,
ctev_pred (cc_ev ct) = (cc_class ct) (cc_tyargs ct)
This holds by construction; look at the unique place where CDictCan is
-built (in TcCanonical).
+built (in GHC.Tc.Solver.Canonical).
In contrast, the type of the evidence *term* (ctev_dest / ctev_evar) in
the evidence may *not* be fully zonked; we are careful not to look at it
@@ -340,7 +335,7 @@ This is for two reasons:
skipping these forms is OK. In addition, the result of a type family cannot
be a polytype, so skipping foralls is OK, too. We skip foralls because we
want the output of the flattener to be almost function-free. See Note
- [Flattening under a forall] in TcFlatten.
+ [Flattening under a forall] in GHC.Tc.Solver.Flatten.
As I (Richard E) write this, it is unclear if the scenario pictured above
can happen -- I would expect the G Int and G Bool to be reduced. But
@@ -352,8 +347,8 @@ injectivity checks were not complete, and adding the requirement that functions
do not appear even in a nested fashion was easy (it was already true, but
unenforced).
-The almost-function-free property is checked by isAlmostFunctionFree in TcType.
-The flattener (in TcFlatten) produces types that are almost function-free.
+The almost-function-free property is checked by isAlmostFunctionFree in GHC.Tc.Utils.TcType.
+The flattener (in GHC.Tc.Solver.Flatten) produces types that are almost function-free.
-}
@@ -542,7 +537,7 @@ set the cc_pend_sc flag to True, so that if we re-process this
CDictCan we will re-generate its derived superclasses. Otherwise
we might miss some fundeps. #13662 showed this up.
-See Note [The superclass story] in TcCanonical.
+See Note [The superclass story] in GHC.Tc.Solver.Canonical.
-}
isDroppableCt :: Ct -> Bool
@@ -799,7 +794,7 @@ getPendingWantedScs simples
{- Note [When superclasses help]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-First read Note [The superclass story] in TcCanonical.
+First read Note [The superclass story] in GHC.Tc.Solver.Canonical.
We expand superclasses and iterate only if there is at unsolved wanted
for which expansion of superclasses (e.g. from given constraints)
@@ -877,7 +872,7 @@ pprCts cts = vcat (map ppr (bagToList cts))
************************************************************************
* *
Wanted constraints
- These are forced to be in TcRnTypes because
+ These are forced to be in GHC.Tc.Types because
TcLclEnv mentions WantedConstraints
WantedConstraint mentions CtLoc
CtLoc mentions ErrCtxt
@@ -1023,7 +1018,7 @@ Residual implication looks like
We do /not/ want to set the implication status to IC_Insoluble,
because that'll suppress reports of [W] C b (f b). But we
may not report the insoluble [G] f b ~# b either (see Note [Given errors]
-in TcErrors), so we may fail to report anything at all! Yikes.
+in GHC.Tc.Errors), so we may fail to report anything at all! Yikes.
The same applies to Derived constraints that /arise from/ Givens.
E.g. f :: (C Int [a]) => blah
@@ -1031,7 +1026,7 @@ where a fundep means we get
[D] Int ~ [a]
By the same reasoning we must not suppress other errors (#15767)
-Bottom line: insolubleWC (called in TcSimplify.setImplicationStatus)
+Bottom line: insolubleWC (called in GHC.Tc.Solver.setImplicationStatus)
should ignore givens even if they are insoluble.
Note [Insoluble holes]
@@ -1069,7 +1064,7 @@ data Implication
ic_given :: [EvVar], -- Given evidence variables
-- (order does not matter)
- -- See Invariant (GivenInv) in TcType
+ -- See Invariant (GivenInv) in GHC.Tc.Utils.TcType
ic_no_eqs :: Bool, -- True <=> ic_givens have no equalities, for sure
-- False <=> ic_givens might have equalities
@@ -1078,7 +1073,7 @@ data Implication
-- True <=> -Winaccessible-code is enabled
-- at construction. See
-- Note [Avoid -Winaccessible-code when deriving]
- -- in TcInstDcls
+ -- in GHC.Tc.TyCl.Instance
ic_env :: TcLclEnv,
-- Records the TcLClEnv at the time of creation.
@@ -1088,7 +1083,7 @@ data Implication
-- hence for all the given evidence variables.
ic_wanted :: WantedConstraints, -- The wanteds
- -- See Invariang (WantedInf) in TcType
+ -- See Invariang (WantedInf) in GHC.Tc.Utils.TcType
ic_binds :: EvBindsVar, -- Points to the place to fill in the
-- abstraction and bindings.
@@ -1128,7 +1123,7 @@ implicationPrototype
data ImplicStatus
= IC_Solved -- All wanteds in the tree are solved, all the way down
{ ics_dead :: [EvVar] } -- Subset of ic_given that are not needed
- -- See Note [Tracking redundant constraints] in TcSimplify
+ -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
| IC_Insoluble -- At least one insoluble constraint in the tree
@@ -1238,8 +1233,8 @@ untouchables, and therefore cannot be unified with anything at all,
let alone the skolems.
Instead, ic_skols is used only when considering floating a constraint
-outside the implication in TcSimplify.floatEqualities or
-TcSimplify.approximateImplications
+outside the implication in GHC.Tc.Solver.floatEqualities or
+GHC.Tc.Solver.approximateImplications
Note [Insoluble constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1465,9 +1460,9 @@ Constraints come in four flavours:
The ctev_nosh field of a Wanted distinguishes between [W] and [WD]
Wanted constraints are born as [WD], but are split into [W] and its
-"shadow" [D] in TcSMonad.maybeEmitShadow.
+"shadow" [D] in GHC.Tc.Solver.Monad.maybeEmitShadow.
-See Note [The improvement story and derived shadows] in TcSMonad
+See Note [The improvement story and derived shadows] in GHC.Tc.Solver.Monad
-}
data CtFlavour -- See Note [Constraint flavours]
@@ -1480,7 +1475,7 @@ data ShadowInfo
= WDeriv -- [WD] This Wanted constraint has no Derived shadow,
-- so it behaves like a pair of a Wanted and a Derived
| WOnly -- [W] It has a separate derived shadow
- -- See Note [The improvement story and derived shadows] in TcSMonad
+ -- See Note [The improvement story and derived shadows] in GHC.Tc.Solver.Monad
deriving( Eq )
isGivenOrWDeriv :: CtFlavour -> Bool
@@ -1501,7 +1496,7 @@ ctEvFlavour (CtDerived {}) = Derived
-- | Whether or not one 'Ct' can rewrite another is determined by its
-- flavour and its equality relation. See also
--- Note [Flavours with roles] in TcSMonad
+-- Note [Flavours with roles] in GHC.Tc.Solver.Monad
type CtFlavourRole = (CtFlavour, EqRel)
-- | Extract the flavour, role, and boxity from a 'CtEvidence'
@@ -1529,7 +1524,7 @@ ctFlavourRole ct
(eqCanRewrite ct1 ct2) holds if the constraint ct1 (a CTyEqCan of form
tv ~ ty) can be used to rewrite ct2. It must satisfy the properties of
a can-rewrite relation, see Definition [Can-rewrite relation] in
-TcSMonad.
+GHC.Tc.Solver.Monad.
With the solver handling Coercible constraints like equality constraints,
the rewrite conditions must take role into account, never allowing
@@ -1550,13 +1545,13 @@ but we do not want to complain about Bool ~ Char!
Note [Deriveds do rewrite Deriveds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However we DO allow Deriveds to rewrite Deriveds, because that's how
-improvement works; see Note [The improvement story] in TcInteract.
+improvement works; see Note [The improvement story] in GHC.Tc.Solver.Interact.
However, for now at least I'm only letting (Derived,NomEq) rewrite
(Derived,NomEq) and not doing anything for ReprEq. If we have
eqCanRewriteFR (Derived, NomEq) (Derived, _) = True
then we lose property R2 of Definition [Can-rewrite relation]
-in TcSMonad
+in GHC.Tc.Solver.Monad
R2. If f1 >= f, and f2 >= f,
then either f1 >= f2 or f2 >= f1
Consider f1 = (Given, ReprEq)
@@ -1644,7 +1639,7 @@ other Deriveds in the model whereas the Wanted cannot.
However a Wanted can certainly discharge an identical Wanted. So
eqCanDischarge does /not/ define a can-rewrite relation in the
-sense of Definition [Can-rewrite relation] in TcSMonad.
+sense of Definition [Can-rewrite relation] in GHC.Tc.Solver.Monad.
We /do/ say that a [W] can discharge a [WD]. In evidence terms it
certainly can, and the /caller/ arranges that the otherwise-lost [D]
diff --git a/compiler/typecheck/TcEvTerm.hs b/compiler/GHC/Tc/Types/EvTerm.hs
index 74ef0ae0b4..db5c6d1ce1 100644
--- a/compiler/typecheck/TcEvTerm.hs
+++ b/compiler/GHC/Tc/Types/EvTerm.hs
@@ -1,6 +1,6 @@
--- (those who have too heavy dependencies for TcEvidence)
-module TcEvTerm
+-- (those who have too heavy dependencies for GHC.Tc.Types.Evidence)
+module GHC.Tc.Types.EvTerm
( evDelayedError, evCallStack )
where
@@ -11,7 +11,7 @@ import GHC.Core.Type
import GHC.Core
import GHC.Core.Make
import GHC.Types.Literal ( Literal(..) )
-import TcEvidence
+import GHC.Tc.Types.Evidence
import GHC.Driver.Types
import GHC.Driver.Session
import GHC.Types.Name
@@ -22,7 +22,7 @@ import GHC.Types.SrcLoc
-- Used with Opt_DeferTypeErrors
-- See Note [Deferring coercion errors to runtime]
--- in TcSimplify
+-- in GHC.Tc.Solver
evDelayedError :: Type -> FastString -> EvTerm
evDelayedError ty msg
= EvExpr $
@@ -34,7 +34,7 @@ evDelayedError ty msg
-- Dictionary for CallStack implicit parameters
evCallStack :: (MonadThings m, HasModule m, HasDynFlags m) =>
EvCallStack -> m EvExpr
--- See Note [Overview of implicit CallStacks] in TcEvidence.hs
+-- See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
evCallStack cs = do
df <- getDynFlags
let platform = targetPlatform df
diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/GHC/Tc/Types/Evidence.hs
index 4e89219271..cf59896f9d 100644
--- a/compiler/typecheck/TcEvidence.hs
+++ b/compiler/GHC/Tc/Types/Evidence.hs
@@ -3,7 +3,7 @@
{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# LANGUAGE LambdaCase #-}
-module TcEvidence (
+module GHC.Tc.Types.Evidence (
-- * HsWrapper
HsWrapper(..),
@@ -59,7 +59,7 @@ import GHC.Types.Var
import GHC.Core.Coercion.Axiom
import GHC.Core.Coercion
import GHC.Core.Ppr () -- Instance OutputableBndr TyVar
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.TyCon
import GHC.Core.DataCon( DataCon, dataConWrapId )
@@ -418,7 +418,7 @@ data EvBindsVar
-- are solved by filling in their HoleDest in-place. Since they
-- don't appear in ebv_binds, we keep track of their free
-- variables so that we can report unused given constraints
- -- See Note [Tracking redundant constraints] in TcSimplify
+ -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
}
| CoEvBindsVar { -- See Note [Coercion evidence only]
@@ -509,7 +509,7 @@ data EvBind
= EvBind { eb_lhs :: EvVar
, eb_rhs :: EvTerm
, eb_is_given :: Bool -- True <=> given
- -- See Note [Tracking redundant constraints] in TcSimplify
+ -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
}
evBindVar :: EvBind -> EvVar
@@ -544,7 +544,7 @@ data EvTerm
type EvExpr = CoreExpr
-- An EvTerm is (usually) constructed by any of the constructors here
--- and those more complicates ones who were moved to module TcEvTerm
+-- and those more complicates ones who were moved to module GHC.Tc.Types.EvTerm
-- | Any sort of evidence Id, including coercions
evId :: EvId -> EvExpr
@@ -647,7 +647,7 @@ Instead we make a binding
g1 :: a~Bool = g |> ax7 a
and the constraint
[G] g1 :: a~Bool
-See #7238 and Note [Bind new Givens immediately] in Constraint
+See #7238 and Note [Bind new Givens immediately] in GHC.Tc.Types.Constraint
Note [EvBinds/EvTerm]
~~~~~~~~~~~~~~~~~~~~~
@@ -714,7 +714,7 @@ important) are solved in three steps:
that we use to solve the call to `error`. The new wanted `d` will
then be solved per rule (1), ie as a regular IP.
- (see TcInteract.interactDict)
+ (see GHC.Tc.Solver.Interact.interactDict)
3. We default any insoluble CallStacks to the empty CallStack. Suppose
`undefined` did not request a CallStack, ie
@@ -732,7 +732,7 @@ important) are solved in three steps:
EvCsEmpty
- (see TcSimplify.simpl_top and TcSimplify.defaultCallStacks)
+ (see GHC.Tc.Solver.simpl_top and GHC.Tc.Solver.defaultCallStacks)
This provides a lightweight mechanism for building up call-stacks
explicitly, but is notably limited by the fact that the stack will
@@ -784,7 +784,7 @@ Important Details:
- When we emit a new wanted CallStack from rule (2) we set its origin to
`IPOccOrigin ip_name` instead of the original `OccurrenceOf func`
- (see TcInteract.interactDict).
+ (see GHC.Tc.Solver.Interact.interactDict).
This is a bit shady, but is how we ensure that the new wanted is
solved like a regular IP.
@@ -887,11 +887,11 @@ Finding the free vars of an EvFun is made tricky by the fact the
bindings et_binds may be a mutable variable. Fortunately, we
can just squeeze by. Here's how.
-* evVarsOfTerm is used only by TcSimplify.neededEvVars.
+* evVarsOfTerm is used only by GHC.Tc.Solver.neededEvVars.
* Each EvBindsVar in an et_binds field of an EvFun is /also/ in the
ic_binds field of an Implication
* So we can track usage via the processing for that implication,
- (see Note [Tracking redundant constraints] in TcSimplify).
+ (see Note [Tracking redundant constraints] in GHC.Tc.Solver).
We can ignore usage from the EvFun altogether.
************************************************************************
@@ -987,7 +987,7 @@ instance Outputable EvTypeable where
-- expect the 'Type' to have the form `IP sym ty` or `IsLabel sym ty`,
-- and return a 'Coercion' `co :: IP sym ty ~ ty` or
-- `co :: IsLabel sym ty ~ Proxy# sym -> ty`. See also
--- Note [Type-checking overloaded labels] in TcExpr.
+-- Note [Type-checking overloaded labels] in GHC.Tc.Gen.Expr.
unwrapIP :: Type -> CoercionR
unwrapIP ty =
case unwrapNewTyCon_maybe tc of
diff --git a/compiler/typecheck/TcOrigin.hs b/compiler/GHC/Tc/Types/Origin.hs
index 502edc6a48..139e416012 100644
--- a/compiler/typecheck/TcOrigin.hs
+++ b/compiler/GHC/Tc/Types/Origin.hs
@@ -1,17 +1,12 @@
-{-
-
-Describes the provenance of types as they flow through the type-checker.
-The datatypes here are mainly used for error message generation.
-
--}
-
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcOrigin (
+-- | Describes the provenance of types as they flow through the type-checker.
+-- The datatypes here are mainly used for error message generation.
+module GHC.Tc.Types.Origin (
-- UserTypeCtxt
UserTypeCtxt(..), pprUserTypeCtxt, isSigMaybe,
@@ -29,7 +24,7 @@ module TcOrigin (
import GhcPrelude
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Hs
@@ -101,7 +96,7 @@ data UserTypeCtxt
-- The Bool indicates if we are checking the outermost
-- type application.
-- See Note [Unsaturated type synonyms in GHCi] in
- -- TcValidity.
+ -- GHC.Tc.Validity.
| ClassSCCtxt Name -- Superclasses of a class
| SigmaCtxt -- Theta part of a normal for-all type
@@ -199,7 +194,7 @@ data SkolemInfo
-- If (C ty1 .. tyn) is the largest class from
-- which we made a superclass selection in the chain,
-- then TypeSize = sizeTypes [ty1, .., tyn]
- -- See Note [Solving superclass constraints] in TcInstDcls
+ -- See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
| FamInstSkol -- Bound at a family instance decl
| PatSkol -- An existential type variable bound by a pattern for
@@ -210,7 +205,7 @@ data SkolemInfo
-- The pattern MkT x will allocate an existential type
-- variable for 'a'.
- | ArrowSkol -- An arrow form (see TcArrows)
+ | ArrowSkol -- An arrow form (see GHC.Tc.Gen.Arrow)
| IPSkol [HsIPName] -- Binding site of an implicit parameter
@@ -323,7 +318,7 @@ in the right place. So we proceed as follows:
- the original signature forall a. a -> forall b. b -> a
- the instantiation mapping [a :-> a', b :-> b']
-* Then when tidying in TcMType.tidySkolemInfo, we first tidy a' to
+* Then when tidying in GHC.Tc.Utils.TcMType.tidySkolemInfo, we first tidy a' to
whatever it tidies to, say a''; and then we walk over the type
replacing the binder a by the tidied version a'', to give
forall a''. a'' -> forall b''. b'' -> a''
@@ -391,7 +386,7 @@ data CtOrigin
| ScOrigin TypeSize -- Typechecking superclasses of an instance declaration
-- If the instance head is C ty1 .. tyn
-- then TypeSize = sizeTypes [ty1, .., tyn]
- -- See Note [Solving superclass constraints] in TcInstDcls
+ -- See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
| DerivClauseOrigin -- Typechecking a deriving clause (as opposed to
-- standalone deriving).
@@ -402,7 +397,7 @@ data CtOrigin
-- is used to inform error messages on how to recommended fixes (e.g., if
-- the argument is True, then don't recommend "use standalone deriving",
-- but rather "fill in the wildcard constraint yourself").
- -- See Note [Inferring the instance context] in TcDerivInfer
+ -- See Note [Inferring the instance context] in GHC.Tc.Deriv.Infer
| DerivOriginCoerce Id Type Type Bool
-- DerivOriginCoerce id ty1 ty2: Trying to coerce class method `id` from
-- `ty1` to `ty2`.
@@ -410,7 +405,7 @@ data CtOrigin
-- constraints coming from a wildcard constraint,
-- e.g., deriving instance _ => Eq (Foo a)
-- See Note [Inferring the instance context]
- -- in TcDerivInfer
+ -- in GHC.Tc.Deriv.Infer
| DefaultOrigin -- Typechecking a default decl
| DoOrigin -- Arising from a do expression
| DoPatOrigin (LPat GhcRn) -- Arising from a failable pattern in
diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs
index be35f02a6e..93cb63812c 100644
--- a/compiler/typecheck/TcBackpack.hs
+++ b/compiler/GHC/Tc/Utils/Backpack.hs
@@ -4,7 +4,8 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
-module TcBackpack (
+
+module GHC.Tc.Utils.Backpack (
findExtraSigImports',
findExtraSigImports,
implicitRequirements',
@@ -21,21 +22,21 @@ import GhcPrelude
import GHC.Types.Basic (defaultFixity, TypeOrKind(..))
import GHC.Driver.Packages
-import TcRnExports
+import GHC.Tc.Gen.Export
import GHC.Driver.Session
import GHC.Hs
import GHC.Types.Name.Reader
-import TcRnMonad
-import TcTyDecls
+import GHC.Tc.Utils.Monad
+import GHC.Tc.TyCl.Utils
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.IfaceToCore
-import TcMType
-import TcType
-import TcSimplify
-import Constraint
-import TcOrigin
+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 ErrUtils
@@ -52,7 +53,7 @@ import GHC.Core.Type
import FastString
import GHC.Rename.Fixity ( lookupFixityRn )
import Maybes
-import TcEnv
+import GHC.Tc.Utils.Env
import GHC.Types.Var
import GHC.Iface.Syntax
import PrelNames
@@ -61,15 +62,15 @@ import qualified Data.Map as Map
import GHC.Driver.Finder
import GHC.Types.Unique.DSet
import GHC.Types.Name.Shape
-import TcErrors
-import TcUnify
+import GHC.Tc.Errors
+import GHC.Tc.Utils.Unify
import GHC.Iface.Rename
import Util
import Control.Monad
import Data.List (find)
-import {-# SOURCE #-} TcRnDriver
+import {-# SOURCE #-} GHC.Tc.Module
#include "HsVersions.h"
@@ -117,7 +118,7 @@ checkHsigIface tcg_env gr sig_iface
[ ppr sig_type_env, ppr sig_insts, ppr sig_exports ]
mapM_ check_export (map availName sig_exports)
unless (null sig_fam_insts) $
- panic ("TcRnDriver.checkHsigIface: Cannot handle family " ++
+ panic ("GHC.Tc.Module.checkHsigIface: Cannot handle family " ++
"instances in hsig files yet...")
-- Delete instances so we don't look them up when
-- checking instance satisfiability
@@ -279,7 +280,7 @@ findExtraSigImports' hsc_env HsigFile modname =
findExtraSigImports' _ _ _ = return emptyUniqDSet
-- | 'findExtraSigImports', but in a convenient form for "GHC.Driver.Make" and
--- "TcRnDriver".
+-- "GHC.Tc.Module".
findExtraSigImports :: HscEnv -> HscSource -> ModuleName
-> IO [(Maybe FastString, Located ModuleName)]
findExtraSigImports hsc_env hsc_src modname = do
@@ -288,7 +289,7 @@ findExtraSigImports hsc_env hsc_src modname = do
| mod_name <- uniqDSetToList extra_requirements ]
-- A version of 'implicitRequirements'' which is more friendly
--- for "GHC.Driver.Make" and "TcRnDriver".
+-- for "GHC.Driver.Make" and "GHC.Tc.Module".
implicitRequirements :: HscEnv
-> [(Maybe FastString, Located ModuleName)]
-> IO [(Maybe FastString, Located ModuleName)]
diff --git a/compiler/typecheck/TcEnv.hs b/compiler/GHC/Tc/Utils/Env.hs
index 01bff1db4c..0154ed157e 100644
--- a/compiler/typecheck/TcEnv.hs
+++ b/compiler/GHC/Tc/Utils/Env.hs
@@ -7,7 +7,7 @@
-- in module GHC.Hs.Extension
{-# LANGUAGE TypeFamilies #-}
-module TcEnv(
+module GHC.Tc.Utils.Env(
TyThing(..), TcTyThing(..), TcId,
-- Instance environment, and InstInfo type
@@ -75,9 +75,9 @@ import GhcPrelude
import GHC.Hs
import GHC.Iface.Env
-import TcRnMonad
-import TcMType
-import TcType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.TcType
import GHC.Iface.Load
import PrelNames
import TysWiredIn
@@ -429,7 +429,7 @@ tcLookupId :: Name -> TcM Id
-- Used when we aren't interested in the binding level, nor refinement.
-- The "no refinement" part means that we return the un-refined Id regardless
--
--- The Id is never a DataCon. (Why does that matter? see TcExpr.tcId)
+-- The Id is never a DataCon. (Why does that matter? see GHC.Tc.Gen.Expr.tcId)
tcLookupId name = do
thing <- tcLookupIdMaybe name
case thing of
@@ -507,7 +507,7 @@ tcExtendNameTyVarEnv binds thing_inside
tv_binds = [TcTvBndr name tv | (name,tv) <- binds]
isTypeClosedLetBndr :: Id -> Bool
--- See Note [Bindings with closed types] in TcRnTypes
+-- See Note [Bindings with closed types] in GHC.Tc.Types
isTypeClosedLetBndr = noFreeVarsOfType . idType
tcExtendRecIds :: [(Name, TcId)] -> TcM a -> TcM a
@@ -759,7 +759,7 @@ in the kind environment when kind-checking the signature for B.
Hence tcAddPatSynPlaceholers adds a binding
A -> APromotionErr PatSynPE
-to the environment. Then TcHsType.tcTyVar will find A in the kind
+to the environment. Then GHC.Tc.Gen.HsType.tcTyVar will find A in the kind
environment, and will give a 'wrongThingErr' as a result. But the
lookup of A won't fail.
@@ -1089,7 +1089,7 @@ notFound name
wrongThingErr :: String -> TcTyThing -> Name -> TcM a
-- It's important that this only calls pprTcTyThingCategory, which in
-- turn does not look at the details of the TcTyThing.
--- See Note [Placeholder PatSyn kinds] in TcBinds
+-- See Note [Placeholder PatSyn kinds] in GHC.Tc.Gen.Bind
wrongThingErr expected thing name
= failWithTc (pprTcTyThingCategory thing <+> quotes (ppr name) <+>
text "used as a" <+> text expected)
diff --git a/compiler/GHC/Tc/Utils/Env.hs-boot b/compiler/GHC/Tc/Utils/Env.hs-boot
new file mode 100644
index 0000000000..7b1cde3c7d
--- /dev/null
+++ b/compiler/GHC/Tc/Utils/Env.hs-boot
@@ -0,0 +1,10 @@
+module GHC.Tc.Utils.Env where
+
+import GHC.Tc.Types( TcM )
+import GHC.Types.Var.Env( TidyEnv )
+
+-- Annoyingly, there's a recursion between tcInitTidyEnv
+-- (which does zonking and hence needs GHC.Tc.Utils.TcMType) and
+-- addErrTc etc which live in GHC.Tc.Utils.Monad. Rats.
+tcInitTidyEnv :: TcM TidyEnv
+
diff --git a/compiler/typecheck/Inst.hs b/compiler/GHC/Tc/Utils/Instantiate.hs
index 61e408e33e..74115d15b0 100644
--- a/compiler/typecheck/Inst.hs
+++ b/compiler/GHC/Tc/Utils/Instantiate.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-The @Inst@ type: dictionaries or method instances
-}
{-# LANGUAGE CPP, MultiWayIf, TupleSections #-}
@@ -12,7 +10,8 @@ The @Inst@ type: dictionaries or method instances
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module Inst (
+-- | The @Inst@ type: dictionaries or method instances
+module GHC.Tc.Utils.Instantiate (
deeplySkolemise,
topInstantiate, topInstantiateInferred, deeplyInstantiate,
instCall, instDFunType, instStupidTheta, instTyVarsWith,
@@ -37,28 +36,28 @@ module Inst (
import GhcPrelude
-import {-# SOURCE #-} TcExpr( tcPolyExpr, tcSyntaxOp )
-import {-# SOURCE #-} TcUnify( unifyType, unifyKind )
+import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcPolyExpr, tcSyntaxOp )
+import {-# SOURCE #-} GHC.Tc.Utils.Unify( unifyType, unifyKind )
import GHC.Types.Basic ( IntegralLit(..), SourceText(..) )
import FastString
import GHC.Hs
-import TcHsSyn
-import TcRnMonad
-import Constraint
+import GHC.Tc.Utils.Zonk
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
-import TcEnv
-import TcEvidence
+import GHC.Tc.Types.Origin
+import GHC.Tc.Utils.Env
+import GHC.Tc.Types.Evidence
import GHC.Core.InstEnv
import TysWiredIn ( heqDataCon, eqDataCon )
import GHC.Core ( isOrphan )
-import FunDeps
-import TcMType
+import GHC.Tc.Instance.FunDeps
+import GHC.Tc.Utils.TcMType
import GHC.Core.Type
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr ( debugPprType )
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Driver.Types
import GHC.Core.Class( Class )
import GHC.Types.Id.Make( mkDictFunId )
@@ -255,7 +254,7 @@ deeplyInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType)
-- That is, wrap :: ty ~> rho
--
-- If you don't need the HsWrapper returned from this function, consider
--- using tcSplitNestedSigmaTys in TcType, which is a pure alternative that
+-- using tcSplitNestedSigmaTys in GHC.Tc.Utils.TcType, which is a pure alternative that
-- only computes the returned TcRhoType.
deeplyInstantiate orig ty =
@@ -548,7 +547,7 @@ newOverloadedLit
newOverloadedLit (XOverLit nec) _ = noExtCon nec
-- Does not handle things that 'shortCutLit' can handle. See also
--- newOverloadedLit in TcUnify
+-- newOverloadedLit in GHC.Tc.Utils.Unify
newNonTrivialOverloadedLit :: CtOrigin
-> HsOverLit GhcRn
-> ExpRhoType
@@ -696,7 +695,7 @@ newClsInst overlap_mode dfun_name tvs theta clas tys
-- The dfun uses the original 'tvs' because
-- (a) they don't need to be fresh
-- (b) they may be mentioned in the ib_binds field of
- -- an InstInfo, and in TcEnv.pprInstInfoDetails it's
+ -- an InstInfo, and in GHC.Tc.Utils.Env.pprInstInfoDetails it's
-- helpful to use the same names
; oflag <- getOverlapFlag overlap_mode
diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 2145b88de9..bd52015c89 100644
--- a/compiler/typecheck/TcRnMonad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -1,8 +1,6 @@
{-
(c) The University of Glasgow 2006
-
-Functions for working with the typechecker environment (setters, getters...).
-}
{-# LANGUAGE CPP, ExplicitForAll, FlexibleInstances, BangPatterns #-}
@@ -12,7 +10,9 @@ Functions for working with the typechecker environment (setters, getters...).
{-# LANGUAGE ViewPatterns #-}
-module TcRnMonad(
+-- | Functions for working with the typechecker environment (setters,
+-- getters...).
+module GHC.Tc.Utils.Monad(
-- * Initialisation
initTc, initTcWithGbl, initTcInteractive, initTcRnIf,
@@ -137,7 +137,7 @@ module TcRnMonad(
ContainsCostCentreState(..), getCCIndexM,
-- * Types etc.
- module TcRnTypes,
+ module GHC.Tc.Types,
module IOEnv
) where
@@ -145,11 +145,11 @@ module TcRnMonad(
import GhcPrelude
-import TcRnTypes -- Re-export all
+import GHC.Tc.Types -- Re-export all
import IOEnv -- Re-export all
-import Constraint
-import TcEvidence
-import TcOrigin
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Origin
import GHC.Hs hiding (LIE)
import GHC.Driver.Types
@@ -158,7 +158,7 @@ import GHC.Types.Name.Reader
import GHC.Types.Name
import GHC.Core.Type
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
import PrelNames
@@ -187,7 +187,7 @@ import qualified GHC.LanguageExtensions as LangExt
import Data.IORef
import Control.Monad
-import {-# SOURCE #-} TcEnv ( tcInitTidyEnv )
+import {-# SOURCE #-} GHC.Tc.Utils.Env ( tcInitTidyEnv )
import qualified Data.Map as Map
@@ -1464,7 +1464,7 @@ newTcEvBinds = do { binds_ref <- newTcRef emptyEvBindMap
, ebv_uniq = uniq }) }
-- | Creates an EvBindsVar incapable of holding any bindings. It still
--- tracks covar usages (see comments on ebv_tcvs in TcEvidence), thus
+-- tracks covar usages (see comments on ebv_tcvs in GHC.Tc.Types.Evidence), thus
-- must be made monadically
newNoTcEvBinds :: TcM EvBindsVar
newNoTcEvBinds
@@ -1596,7 +1596,7 @@ pushTcLevelM_ :: TcM a -> TcM a
pushTcLevelM_ x = updLclEnv (\ env -> env { tcl_tclvl = pushTcLevel (tcl_tclvl env) }) x
pushTcLevelM :: TcM a -> TcM (TcLevel, a)
--- See Note [TcLevel assignment] in TcType
+-- See Note [TcLevel assignment] in GHC.Tc.Utils.TcType
pushTcLevelM thing_inside
= do { env <- getLclEnv
; let tclvl' = pushTcLevel (tcl_tclvl env)
@@ -1724,7 +1724,7 @@ That's probably ok; but see th/5358 as a not-so-good example:
foo = $(...raises exception...)
We report the exception, but not the bug in t1. Oh well. Possible
-solution: make TcUnify.uType spot manifestly-insoluble constraints.
+solution: make GHC.Tc.Utils.Unify.uType spot manifestly-insoluble constraints.
************************************************************************
diff --git a/compiler/typecheck/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs
index e234c5195c..1469170847 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/GHC/Tc/Utils/TcMType.hs
@@ -2,18 +2,17 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Monadic type operations
-
-This module contains monadic operations over types that contain
-mutable type variables.
-}
{-# LANGUAGE CPP, TupleSections, MultiWayIf #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcMType (
+-- | Monadic type operations
+--
+-- This module contains monadic operations over types that contain mutable type
+-- variables.
+module GHC.Tc.Utils.TcMType (
TcTyVar, TcKind, TcType, TcTauType, TcThetaType, TcTyVarSet,
--------------------------------
@@ -99,19 +98,19 @@ import GhcPrelude
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr
-import TcType
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.TyCon
import GHC.Core.Coercion
import GHC.Core.Class
import GHC.Types.Var
import GHC.Core.Predicate
-import TcOrigin
+import GHC.Tc.Types.Origin
-- others:
-import TcRnMonad -- TcType, amongst others
-import Constraint
-import TcEvidence
+import GHC.Tc.Utils.Monad -- TcType, amongst others
+import GHC.Tc.Types.Constraint
+import GHC.Tc.Types.Evidence
import GHC.Types.Id as Id
import GHC.Types.Name
import GHC.Types.Var.Set
@@ -307,7 +306,7 @@ predTypeOccName ty = case classifyPredType ty of
--
-- This is monadic to look up the 'TcLclEnv', which is used to initialize
-- 'ic_env', and to set the -Winaccessible-code flag. See
--- Note [Avoid -Winaccessible-code when deriving] in TcInstDcls.
+-- Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.
newImplication :: TcM Implication
newImplication
= do env <- getLclEnv
@@ -430,7 +429,7 @@ Consider
This is a classic untouchable-variable / ambiguous GADT return type
scenario. But, with ExpTypes, we'll be inferring the type of the RHS.
And, because there is only one branch of the case, we won't trigger
-Note [Case branches must never infer a non-tau type] of TcMatches.
+Note [Case branches must never infer a non-tau type] of GHC.Tc.Gen.Match.
We thus must track a TcLevel in an Inferring ExpType. If we try to
fill the ExpType and find that the TcLevels don't work out, we
fill the ExpType with a tau-tv at the low TcLevel, hopefully to
@@ -439,7 +438,7 @@ test gadt/gadt-escape1.
-}
--- actual data definition is in TcType
+-- actual data definition is in GHC.Tc.Utils.TcType
-- | Make an 'ExpType' suitable for inferring a type of kind * or #.
newInferExpTypeNoInst :: TcM ExpSigmaType
@@ -593,12 +592,12 @@ tcInstSkolTyVarsAt lvl overlappable subst tvs
freshenTyVarBndrs :: [TyVar] -> TcM (TCvSubst, [TyVar])
-- ^ Give fresh uniques to a bunch of TyVars, but they stay
-- as TyVars, rather than becoming TcTyVars
--- Used in FamInst.newFamInst, and Inst.newClsInst
+-- Used in GHC.Tc.Instance.Family.newFamInst, and Inst.newClsInst
freshenTyVarBndrs = freshenTyCoVars mkTyVar
freshenCoVarBndrsX :: TCvSubst -> [CoVar] -> TcM (TCvSubst, [CoVar])
-- ^ Give fresh uniques to a bunch of CoVars
--- Used in FamInst.newFamInst
+-- Used in GHC.Tc.Instance.Family.newFamInst
freshenCoVarBndrsX subst = freshenTyCoVarsX mkCoVar subst
------------------
@@ -646,7 +645,7 @@ c) It's a complete freshening operation: the skolems have a fresh
d) The resulting skolems are
non-overlappable for tcInstSkolTyVars,
but overlappable for tcInstSuperSkolTyVars
- See TcDerivInfer Note [Overlap and deriving] for an example
+ See GHC.Tc.Deriv.Infer Note [Overlap and deriving] for an example
of where this matters.
Note [Kind substitution when instantiating]
@@ -689,15 +688,15 @@ types (GHC Proposal 29).
The remaining uses of newTyVarTyVars are
* In kind signatures, see
- TcTyClsDecls Note [Inferring kinds for type declarations]
+ GHC.Tc.TyCl Note [Inferring kinds for type declarations]
and Note [Kind checking for GADTs]
* In partial type signatures, see Note [Quantified variables in partial type signatures]
-}
newMetaTyVarName :: FastString -> TcM Name
-- Makes a /System/ Name, which is eagerly eliminated by
--- the unifier; see TcUnify.nicer_to_update_tv1, and
--- TcCanonical.canEqTyVarTyVar (nicer_to_update_tv2)
+-- the unifier; see GHC.Tc.Utils.Unify.nicer_to_update_tv1, and
+-- GHC.Tc.Solver.Canonical.canEqTyVarTyVar (nicer_to_update_tv2)
newMetaTyVarName str
= do { uniq <- newUnique
; return (mkSystemName uniq (mkTyVarOccFS str)) }
@@ -887,7 +886,7 @@ writeMetaTyVarRef tyvar ref ty
; zonked_ty_kind <- zonkTcType ty_kind
; let kind_check_ok = tcIsConstraintKind zonked_tv_kind
|| tcEqKind zonked_ty_kind zonked_tv_kind
- -- Hack alert! tcIsConstraintKind: see TcHsType
+ -- Hack alert! tcIsConstraintKind: see GHC.Tc.Gen.HsType
-- Note [Extra-constraint holes in partial type signatures]
kind_msg = hang (text "Ill-kinded update to meta tyvar")
@@ -930,7 +929,7 @@ we expect that the TcLevel of 'ty' will be <= lvl.
However, during unflatting we do
fuv:l := ty:(l+1)
which is usually wrong; hence the check isFmmvTyVar in level_check_ok.
-See Note [TcLevel assignment] in TcType.
+See Note [TcLevel assignment] in GHC.Tc.Utils.TcType.
-}
{-
@@ -1141,7 +1140,7 @@ So alpha is entirely unconstrained.
What then should we do with alpha? During generalization, every
metavariable is either (A) promoted, (B) generalized, or (C) zapped
-(according to Note [Recipe for checking a signature] in TcHsType).
+(according to Note [Recipe for checking a signature] in GHC.Tc.Gen.HsType).
* We can't generalise it.
* We can't promote it, because its kind prevents that
@@ -1500,7 +1499,7 @@ Note [Use level numbers for quantification]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The level numbers assigned to metavariables are very useful. Not only
do they track touchability (Note [TcLevel and untouchable type variables]
-in TcType), but they also allow us to determine which variables to
+in GHC.Tc.Utils.TcType), but they also allow us to determine which variables to
generalise. The rule is this:
When generalising, quantify only metavariables with a TcLevel greater
@@ -1530,8 +1529,8 @@ we leave it alone.
Note that not *every* variable with a higher level will get generalised,
either due to the monomorphism restriction or other quirks. See, for
-example, the code in TcSimplify.decideMonoTyVars and in
-TcHsType.kindGeneralizeSome, both of which exclude certain otherwise-eligible
+example, the code in GHC.Tc.Solver.decideMonoTyVars and in
+GHC.Tc.Gen.HsType.kindGeneralizeSome, both of which exclude certain otherwise-eligible
variables from being generalised.
Using level numbers for quantification is implemented in the candidateQTyVars...
@@ -1690,9 +1689,9 @@ defaultTyVar default_kind tv
| isTyVarTyVar tv
-- Do not default TyVarTvs. Doing so would violate the invariants
- -- on TyVarTvs; see Note [Signature skolems] in TcType.
+ -- on TyVarTvs; see Note [Signature skolems] in GHC.Tc.Utils.TcType.
-- #13343 is an example; #14555 is another
- -- See Note [Inferring kinds for type declarations] in TcTyClsDecls
+ -- See Note [Inferring kinds for type declarations] in GHC.Tc.TyCl
= return False
@@ -1725,7 +1724,7 @@ defaultTyVar default_kind tv
, text "Perhaps enable PolyKinds or add a kind signature" ])
-- We failed to default it, so return False to say so.
-- Hence, it'll get skolemised. That might seem odd, but we must either
- -- promote, skolemise, or zap-to-Any, to satisfy TcHsType
+ -- promote, skolemise, or zap-to-Any, to satisfy GHC.Tc.Gen.HsType
-- Note [Recipe for checking a signature]
-- Otherwise we get level-number assertion failures. It doesn't matter much
-- because we are in an error situation anyway.
@@ -1853,14 +1852,14 @@ It leads to the deferral of an equality (wrapped in an implication constraint)
forall a. () => ((String -> String -> String) ~ a)
-which is propagated up to the toplevel (see TcSimplify.tcSimplifyInferCheck).
+which is propagated up to the toplevel (see GHC.Tc.Solver.tcSimplifyInferCheck).
In the meantime `a' is zonked and quantified to form `evalRHS's signature.
This has the *side effect* of also zonking the `a' in the deferred equality
(which at this point is being handed around wrapped in an implication
constraint).
Finally, the equality (with the zonked `a') will be handed back to the
-simplifier by TcRnDriver.tcRnSrcDecls calling TcSimplify.tcSimplifyTop.
+simplifier by GHC.Tc.Module.tcRnSrcDecls calling GHC.Tc.Solver.tcSimplifyTop.
If we zonk `a' with a regular type variable, we will have this regular type
variable now floating around in the simplifier, which in many places assumes to
only see proper TcTyVars.
@@ -1877,7 +1876,7 @@ As Note [Inferring kinds for type declarations] discusses,
we make a TyVarTv for 'a'. Later we skolemise it, and we'd
like to retain its identity, location info etc. (If we don't
retain its identity we'll have to do some pointless swizzling;
-see TcTyClsDecls.swizzleTcTyConBndrs. If we retain its identity
+see GHC.Tc.TyCl.swizzleTcTyConBndrs. If we retain its identity
but not its location we'll lose the detailed binding site info.
Conclusion: use the Name of the TyVarTv. But we don't want
@@ -1950,7 +1949,7 @@ zonkTyCoVar tv | isTcTyVar tv = zonkTcTyVar tv
mkCoercionTy . mkCoVarCo <$> zonkTyCoVarKind tv
-- Hackily, when typechecking type and class decls
-- we have TyVars in scope added (only) in
- -- TcHsType.bindTyClTyVars, but it seems
+ -- GHC.Tc.Gen.HsType.bindTyClTyVars, but it seems
-- painful to make them into TcTyVars there
zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet
@@ -2028,7 +2027,7 @@ zonkCt tries to maintain the canonical form of a Ct. For example,
- a CIrredCan should stay a CIrredCan with its cc_status flag intact
Why?, for example:
-- For CDictCan, the @TcSimplify.expandSuperClasses@ step, which runs after the
+- For CDictCan, the @GHC.Tc.Solver.expandSuperClasses@ step, which runs after the
simple wanted and plugin loop, looks for @CDictCan@s. If a plugin is in use,
constraints are zonked before being passed to the plugin. This means if we
don't preserve a canonical form, @expandSuperClasses@ fails to expand
@@ -2047,7 +2046,7 @@ NB: we do not expect to see any CFunEqCans, because zonkCt is only
called on unflattened constraints.
NB: Constraints are always re-flattened etc by the canonicaliser in
-@TcCanonical@ even if they come in as CDictCan. Only canonical constraints that
+@GHC.Tc.Solver.Canonical@ even if they come in as CDictCan. Only canonical constraints that
are actually in the inert set carry all the guarantees. So it is okay if zonkCt
creates e.g. a CDictCan where the cc_tyars are /not/ function free.
-}
@@ -2217,7 +2216,7 @@ This is easily achieved: just overwrite (Indirect ty) with (Indirect
zty). Non-systematic perf comparisons suggest that this is a modest
win.
-But c.f Note [Sharing when zonking to Type] in TcHsSyn.
+But c.f Note [Sharing when zonking to Type] in GHC.Tc.Utils.Zonk.
%************************************************************************
%* *
diff --git a/compiler/typecheck/TcType.hs b/compiler/GHC/Tc/Utils/TcType.hs
index bc575cef66..1f076e2101 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/GHC/Tc/Utils/TcType.hs
@@ -2,23 +2,21 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section[TcType]{Types used in the typechecker}
-
-This module provides the Type interface for front-end parts of the
-compiler. These parts
-
- * treat "source types" as opaque:
- newtypes, and predicates are meaningful.
- * look through usage types
-
-The "tc" prefix is for "TypeChecker", because the type checker
-is the principal client.
-}
{-# LANGUAGE CPP, ScopedTypeVariables, MultiWayIf, FlexibleContexts #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcType (
+-- | Types used in the typechecker}
+--
+-- This module provides the Type interface for front-end parts of the
+-- compiler. These parts
+--
+-- * treat "source types" as opaque:
+-- newtypes, and predicates are meaningful.
+-- * look through usage types
+--
+module GHC.Tc.Utils.TcType (
--------------------------------
-- Types
TcType, TcSigmaType, TcRhoType, TcTauType, TcPredType, TcThetaType,
@@ -296,7 +294,7 @@ reasons:
See calls to tcExtendTyVarEnv for other places that ordinary
TyVars are bought into scope, and hence may show up in the types
- and kinds generated by TcHsType.
+ and kinds generated by GHC.Tc.Gen.HsType.
- The pattern-match overlap checker calls the constraint solver,
long after TcTyVars have been zonked away
@@ -323,7 +321,7 @@ There are several places in the GHC codebase where functions like
tyCoVarsOfType, tyCoVarsOfCt, et al. are used to compute the free type
variables of a type. The "Co" part of these functions' names shouldn't be
dismissed, as it is entirely possible that they will include coercion variables
-in addition to type variables! As a result, there are some places in TcType
+in addition to type variables! As a result, there are some places in GHC.Tc.Utils.TcType
where we must take care to check that a variable is a _type_ variable (using
isTyVar) before calling tcTyVarDetails--a partial function that is not defined
for coercion variables--on the variable. Failing to do so led to
@@ -361,21 +359,21 @@ type TcDTyCoVarSet = DTyCoVarSet
********************************************************************* -}
-- | An expected type to check against during type-checking.
--- See Note [ExpType] in TcMType, where you'll also find manipulators.
+-- See Note [ExpType] in GHC.Tc.Utils.TcMType, where you'll also find manipulators.
data ExpType = Check TcType
| Infer !InferResult
data InferResult
= IR { ir_uniq :: Unique -- For debugging only
- , ir_lvl :: TcLevel -- See Note [TcLevel of ExpType] in TcMType
+ , ir_lvl :: TcLevel -- See Note [TcLevel of ExpType] in GHC.Tc.Utils.TcMType
, ir_inst :: Bool
-- True <=> deeply instantiate before returning
-- i.e. return a RhoType
-- False <=> do not instantiate before returning
-- i.e. return a SigmaType
- -- See Note [Deep instantiation of InferResult] in TcUnify
+ -- See Note [Deep instantiation of InferResult] in GHC.Tc.Utils.Unify
, ir_ref :: IORef (Maybe TcType) }
-- The type that fills in this hole should be a Type,
@@ -417,7 +415,7 @@ mkCheckExpType = Check
-- for the 'SynType', because you've said positively that it should be an
-- Int, and so it shall be.
--
--- This is defined here to avoid defining it in TcExpr.hs-boot.
+-- This is defined here to avoid defining it in GHC.Tc.Gen.Expr boot file.
data SyntaxOpType
= SynAny -- ^ Any type
| SynRho -- ^ A rho type, deeply skolemised or instantiated as appropriate
@@ -504,7 +502,7 @@ we would need to enforce the separation.
data TcTyVarDetails
= SkolemTv -- A skolem
TcLevel -- Level of the implication that binds it
- -- See TcUnify Note [Deeper level on the left] for
+ -- See GHC.Tc.Utils.Unify Note [Deeper level on the left] for
-- how this level number is used
Bool -- True <=> this skolem type variable can be overlapped
-- when looking up instances
@@ -551,13 +549,13 @@ data MetaInfo
| FlatMetaTv -- A flatten meta-tyvar
-- It is a meta-tyvar, but it is always untouchable, with level 0
- -- See Note [The flattening story] in TcFlatten
+ -- See Note [The flattening story] in GHC.Tc.Solver.Flatten
| FlatSkolTv -- A flatten skolem tyvar
-- Just like FlatMetaTv, but is completely "owned" by
-- its Given CFunEqCan.
-- It is filled in /only/ by unflattenGivens
- -- See Note [The flattening story] in TcFlatten
+ -- See Note [The flattening story] in GHC.Tc.Solver.Flatten
instance Outputable MetaDetails where
ppr Flexi = text "Flexi"
@@ -787,7 +785,7 @@ tcTyFamInsts = map (\(_,b,c) -> (b,c)) . tcTyFamInstsAndVis
-- to @C@, whereas @F Bool@ is paired with 'False' since it appears an a
-- /visible/ argument to @C@.
--
--- See also @Note [Kind arguments in error messages]@ in "TcErrors".
+-- See also @Note [Kind arguments in error messages]@ in "GHC.Tc.Errors".
tcTyFamInstsAndVis :: Type -> [(Bool, TyCon, [Type])]
tcTyFamInstsAndVis = tcTyFamInstsAndVisX False
@@ -921,7 +919,7 @@ exactTyCoVarsOfType is used by the type checker to figure out exactly
which type variables are mentioned in a type. It only matters
occasionally -- see the calls to exactTyCoVarsOfType.
-We place this function here in TcType, not in GHC.Core.TyCo.FVs,
+We place this function here in GHC.Tc.Utils.TcType, not in GHC.Core.TyCo.FVs,
because we want to "see" tcView (efficiency issue only).
-}
@@ -1095,7 +1093,7 @@ isIndirect (Indirect _) = True
isIndirect _ = False
isRuntimeUnkSkol :: TyVar -> Bool
--- Called only in TcErrors; see Note [Runtime skolems] there
+-- Called only in GHC.Tc.Errors; see Note [Runtime skolems] there
isRuntimeUnkSkol x
| RuntimeUnk <- tcTyVarDetails x = True
| otherwise = False
@@ -1636,8 +1634,8 @@ checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool
-- If the Bool is True (flexible contexts), return True (i.e. ok)
-- Otherwise, check that the type (not kind) args are all headed by a tyvar
-- E.g. (Eq a) accepted, (Eq (f a)) accepted, but (Eq Int) rejected
--- This function is here rather than in TcValidity because it is
--- called from TcSimplify, which itself is imported by TcValidity
+-- This function is here rather than in GHC.Tc.Validity because it is
+-- called from GHC.Tc.Solver, which itself is imported by GHC.Tc.Validity
checkValidClsArgs flexible_contexts cls kts
| flexible_contexts = True
| otherwise = all hasTyVarHead tys
@@ -1769,7 +1767,7 @@ mkMinimalBySCs :: forall a. (a -> PredType) -> [a] -> [a]
-- - can be deduced from another by superclasses,
--
-- - are a reflexive equality (e.g * ~ *)
--- (see Note [Remove redundant provided dicts] in TcPatSyn)
+-- (see Note [Remove redundant provided dicts] in GHC.Tc.TyCl.PatSyn)
--
-- The result is a subset of the input.
-- The 'a' is just paired up with the PredType;
@@ -1791,7 +1789,7 @@ mkMinimalBySCs get_pred xs = go preds_with_scs []
-- order as the input, which is generally saner
go (work_item@(p,_,_) : work_list) min_preds
| EqPred _ t1 t2 <- classifyPredType p
- , t1 `tcEqType` t2 -- See TcPatSyn
+ , t1 `tcEqType` t2 -- See GHC.Tc.TyCl.PatSyn
-- Note [Remove redundant provided dicts]
= go work_list min_preds
| p `in_cloud` work_list || p `in_cloud` min_preds
@@ -1846,7 +1844,7 @@ isImprovementPred ty
-- a ~R ...(N a)... -- Not definitely insoluble
-- -- Perhaps newtype N a = MkN Int
-- See Note [Occurs check error] in
--- TcCanonical for the motivation for this function.
+-- GHC.Tc.Solver.Canonical for the motivation for this function.
isInsolubleOccursCheck :: EqRel -> TcTyVar -> TcType -> Bool
isInsolubleOccursCheck eq_rel tv ty
= go ty
@@ -1889,7 +1887,7 @@ Then
Notice that in the recursive-superclass case we include C again at
the end of the chain. One could exclude C in this case, but
the code is more awkward and there seems no good reason to do so.
-(However C.f. TcCanonical.mk_strict_superclasses, which /does/
+(However C.f. GHC.Tc.Solver.Canonical.mk_strict_superclasses, which /does/
appear to do so.)
The algorithm is expand( so_far, pred ):
@@ -1917,7 +1915,7 @@ Notice that
as non-recursive (in some sense). For now, we just make a special
case for tuples. Something better would be cool.
-See also TcTyDecls.checkClassCycles.
+See also GHC.Tc.TyCl.Utils.checkClassCycles.
Note [Lift equality constraints when quantifying]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2102,7 +2100,7 @@ isRigidTy ty
-- | Is this type *almost function-free*? See Note [Almost function-free]
--- in TcRnTypes
+-- in GHC.Tc.Types
isAlmostFunctionFree :: TcType -> Bool
isAlmostFunctionFree ty | Just ty' <- tcView ty = isAlmostFunctionFree ty'
isAlmostFunctionFree (TyVarTy {}) = True
diff --git a/compiler/typecheck/TcType.hs-boot b/compiler/GHC/Tc/Utils/TcType.hs-boot
index 2bc14735f1..481d261f79 100644
--- a/compiler/typecheck/TcType.hs-boot
+++ b/compiler/GHC/Tc/Utils/TcType.hs-boot
@@ -1,4 +1,4 @@
-module TcType where
+module GHC.Tc.Utils.TcType where
import Outputable( SDoc )
data MetaDetails
diff --git a/compiler/typecheck/TcUnify.hs b/compiler/GHC/Tc/Utils/Unify.hs
index ae55f7b36c..f6d934af9a 100644
--- a/compiler/typecheck/TcUnify.hs
+++ b/compiler/GHC/Tc/Utils/Unify.hs
@@ -2,8 +2,6 @@
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-
-Type subsumption and unification
-}
{-# LANGUAGE CPP, DeriveFunctor, MultiWayIf, TupleSections,
@@ -12,7 +10,8 @@ Type subsumption and unification
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcUnify (
+-- | Type subsumption and unification
+module GHC.Tc.Utils.Unify (
-- Full-blown subsumption
tcWrapResult, tcWrapResultO, tcSkolemise, tcSkolemiseET,
tcSubTypeHR, tcSubTypeO, tcSubType_NC, tcSubTypeDS,
@@ -46,17 +45,17 @@ import GhcPrelude
import GHC.Hs
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr( debugPprType )
-import TcMType
-import TcRnMonad
-import TcType
+import GHC.Tc.Utils.TcMType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
import GHC.Core.Type
import GHC.Core.Coercion
-import TcEvidence
-import Constraint
+import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.Constraint
import GHC.Core.Predicate
-import TcOrigin
+import GHC.Tc.Types.Origin
import GHC.Types.Name( isSystemName )
-import Inst
+import GHC.Tc.Utils.Instantiate
import GHC.Core.TyCon
import TysWiredIn
import TysPrim( tYPE )
@@ -257,7 +256,7 @@ matchActualFunTysPart herald ct_orig mb_thing arity orig_ty
-- (*) Sometimes it's necessary to call matchActualFunTys with only part
-- (that is, to the right of some arrows) of the type of the function in
--- question. (See TcExpr.tcArgs.) This argument is the reversed list of
+-- question. (See GHC.Tc.Gen.Expr.tcArgs.) This argument is the reversed list of
-- arguments already seen (that is, not part of the TcSigmaType passed
-- in elsewhere).
@@ -840,7 +839,7 @@ to a UserTypeCtxt of GenSigCtxt. Why?
* Implications. We may decide to build an implication for the whole
ambiguity check, but we don't need one for each level within it,
- and TcUnify.alwaysBuildImplication checks the UserTypeCtxt.
+ and GHC.Tc.Utils.Unify.alwaysBuildImplication checks the UserTypeCtxt.
See Note [When to build an implication]
-}
@@ -870,7 +869,7 @@ tcWrapResultO orig rn_expr expr actual_ty res_ty
%********************************************************************* -}
-- | Infer a type using a fresh ExpType
--- See also Note [ExpType] in TcMType
+-- See also Note [ExpType] in GHC.Tc.Utils.TcMType
-- Does not attempt to instantiate the inferred type
tcInferNoInst :: (ExpSigmaType -> TcM a) -> TcM (a, TcSigmaType)
tcInferNoInst = tcInfer False
@@ -962,7 +961,7 @@ ir_inst = False: do not instantiate
(let { f :: forall a. a -> a; f x = x } in f) @Int
- We'll call TcExpr.tcInferFun to infer the type of the (let .. in f)
+ We'll call GHC.Tc.Gen.Expr.tcInferFun to infer the type of the (let .. in f)
And we don't want to instantiate the type of 'f' when we reach it,
else the outer visible type application won't work
@@ -1211,7 +1210,7 @@ emitResidualTvConstraint skol_info m_telescope skol_tvs tclvl wanted
, isNothing m_telescope || skol_tvs `lengthAtMost` 1
-- If m_telescope is (Just d), we must do the bad-telescope check,
-- so we must /not/ discard the implication even if there are no
- -- wanted constraints. See Note [Checking telescopes] in Constraint.
+ -- wanted constraints. See Note [Checking telescopes] in GHC.Tc.Types.Constraint.
-- Lacking this check led to #16247
= return ()
@@ -1314,7 +1313,7 @@ take care:
We must have an EvBindsVar those bindings!, otherwise they end up as
top-level unlifted bindings, which are verboten. This only matters
at top level, so we check for that
- See also Note [Deferred errors for coercion holes] in TcErrors.
+ See also Note [Deferred errors for coercion holes] in GHC.Tc.Errors.
cf #14149 for an example of what goes wrong.
* If you have
@@ -1707,7 +1706,7 @@ uUnfilledVar2 origin t_or_k swapped tv1 ty2
then do { writeMetaTyVar tv1 ty2'
; return (mkTcNomReflCo ty2') }
- else defer } -- This cannot be solved now. See TcCanonical
+ else defer } -- This cannot be solved now. See GHC.Tc.Solver.Canonical
-- Note [Equalities with incompatible kinds]
| otherwise
@@ -1765,8 +1764,8 @@ Given (a ~ b), should we orient the CTyEqCan as (a~b) or (b~a)?
This is a surprisingly tricky question! This is invariant (TyEq:TV).
The question is answered by swapOverTyVars, which is use
- - in the eager unifier, in TcUnify.uUnfilledVar1
- - in the constraint solver, in TcCanonical.canEqTyVarHomo
+ - in the eager unifier, in GHC.Tc.Utils.Unify.uUnfilledVar1
+ - in the constraint solver, in GHC.Tc.Solver.Canonical.canEqTyVarHomo
First note: only swap if you have to!
See Note [Avoid unnecessary swaps]
@@ -1782,7 +1781,7 @@ So we look for a positive reason to swap, using a three-step test:
Generally speaking we always try to put a MetaTv on the left
in preference to SkolemTv or RuntimeUnkTv:
a) Because the MetaTv may be touchable and can be unified
- b) Even if it's not touchable, TcSimplify.floatEqualities
+ b) Even if it's not touchable, GHC.Tc.Solver.floatEqualities
looks for meta tyvars on the left
Tie-breaking rules for MetaTvs:
@@ -1829,7 +1828,7 @@ Wanteds and Givens, but either way, deepest wins! Simple.
Otherwise it can't. By putting the deepest variable on the left
we maximise our changes of eliminating skolem capture.
- See also TcSMonad Note [Let-bound skolems] for another reason
+ See also GHC.Tc.Solver.Monad Note [Let-bound skolems] for another reason
to orient with the deepest skolem on the left.
IMPORTANT NOTE: this test does a level-number comparison on
@@ -2025,10 +2024,10 @@ Hence, if the occurs check fails for a type synonym application, then (and *only
the ok function expands the synonym to detect opportunities for occurs check success using
the underlying definition of the type synonym.
-The same applies later on in the constraint interaction code; see TcInteract,
+The same applies later on in the constraint interaction code; see GHC.Tc.Solver.Interact,
function @occ_check_ok@.
-Note [Non-TcTyVars in TcUnify]
+Note [Non-TcTyVars in GHC.Tc.Utils.Unify]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Because the same code is now shared between unifying types and unifying
kinds, we sometimes will see proper TyVars floating around the unifier.
@@ -2044,7 +2043,7 @@ and RHS, discovering that the instance really should be
During this kind-checking, all the tyvars will be TcTyVars. Then, however,
as a second pass, we desugar the RHS (which is done in functions prefixed
-with "tc" in TcTyClsDecls"). By this time, all the kind-vars are proper
+with "tc" in GHC.Tc.TyCl"). By this time, all the kind-vars are proper
TyVars, not TcTyVars, get some kind unification must happen.
Thus, we always check if a TyVar is a TcTyVar before asking if it's a
diff --git a/compiler/typecheck/TcUnify.hs-boot b/compiler/GHC/Tc/Utils/Unify.hs-boot
index 3b12153704..a281bf136b 100644
--- a/compiler/typecheck/TcUnify.hs-boot
+++ b/compiler/GHC/Tc/Utils/Unify.hs-boot
@@ -1,15 +1,15 @@
-module TcUnify where
+module GHC.Tc.Utils.Unify where
import GhcPrelude
-import TcType ( TcTauType )
-import TcRnTypes ( TcM )
-import TcEvidence ( TcCoercion )
+import GHC.Tc.Utils.TcType ( TcTauType )
+import GHC.Tc.Types ( TcM )
+import GHC.Tc.Types.Evidence ( TcCoercion )
import GHC.Hs.Expr ( HsExpr )
import GHC.Hs.Types ( HsType )
import GHC.Hs.Extension ( GhcRn )
-- This boot file exists only to tie the knot between
--- TcUnify and Inst
+-- GHC.Tc.Utils.Unify and Inst
unifyType :: Maybe (HsExpr GhcRn) -> TcTauType -> TcTauType -> TcM TcCoercion
unifyKind :: Maybe (HsType GhcRn) -> TcTauType -> TcTauType -> TcM TcCoercion
diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/GHC/Tc/Utils/Zonk.hs
index da6f0a39e1..057535d65d 100644
--- a/compiler/typecheck/TcHsSyn.hs
+++ b/compiler/GHC/Tc/Utils/Zonk.hs
@@ -2,11 +2,6 @@
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1996-1998
-
-TcHsSyn: Specialisations of the @HsSyn@ syntax for the typechecker
-
-This module is an extension of @HsSyn@ syntax, for use in the type
-checker.
-}
{-# LANGUAGE CPP, TupleSections #-}
@@ -16,7 +11,10 @@ checker.
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module TcHsSyn (
+-- | Specialisations of the @HsSyn@ syntax for the typechecker
+--
+-- This module is an extension of @HsSyn@ syntax, for use in the type checker.
+module GHC.Tc.Utils.Zonk (
-- * Extracting types from HsSyn
hsLitType, hsPatType, hsLPatType,
@@ -31,7 +29,7 @@ module TcHsSyn (
-- * Zonking
-- | For a description of "zonking", see Note [What is zonking?]
- -- in TcMType
+ -- in GHC.Tc.Utils.TcMType
zonkTopDecls, zonkTopExpr, zonkTopLExpr,
zonkTopBndrs,
ZonkEnv, ZonkFlexi(..), emptyZonkEnv, mkEmptyZonkEnv, initZonkEnv,
@@ -54,13 +52,13 @@ import GHC.Hs
import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Core.Predicate
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import PrelNames
-import BuildTyCl ( TcMethInfo, MethInfo )
-import TcType
-import TcMType
-import TcEnv ( tcLookupGlobalOnly )
-import TcEvidence
+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 TysPrim
import GHC.Core.TyCon
@@ -84,7 +82,7 @@ import Util
import GHC.Types.Unique.FM
import GHC.Core
-import {-# SOURCE #-} TcSplice (runTopSplice)
+import {-# SOURCE #-} GHC.Tc.Gen.Splice (runTopSplice)
import Control.Monad
import Data.List ( partition )
@@ -201,10 +199,10 @@ It's all pretty boring stuff, because HsSyn is such a large type, and
the environment manipulation is tiresome.
-}
--- Confused by zonking? See Note [What is zonking?] in TcMType.
+-- Confused by zonking? See Note [What is zonking?] in GHC.Tc.Utils.TcMType.
-- | See Note [The ZonkEnv]
--- Confused by zonking? See Note [What is zonking?] in TcMType.
+-- Confused by zonking? See Note [What is zonking?] in GHC.Tc.Utils.TcMType.
data ZonkEnv -- See Note [The ZonkEnv]
= ZonkEnv { ze_flexi :: ZonkFlexi
, ze_tv_env :: TyCoVarEnv TyCoVar
@@ -954,7 +952,7 @@ carry around different environments to use for the different arguments.
However, this becomes a logistical nightmare, especially in dealing with
the more exotic Stmt forms. So, we simplify by making the critical
assumption that the uniques of the skolems are different. (This assumption
-is justified by the use of newUnique in TcMType.instSkolTyCoVarX.)
+is justified by the use of newUnique in GHC.Tc.Utils.TcMType.instSkolTyCoVarX.)
Now, we can safely just extend one environment.
-}
@@ -1692,8 +1690,8 @@ to a lot of effort to prove Refl! (Eg when solving 10+3 = 10+3; cf #5030)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Problem:
- In TcMType.zonkTcTyVar, we short-circuit (Indirect ty) to
- (Indirect zty), see Note [Sharing in zonking] in TcMType. But we
+ In GHC.Tc.Utils.TcMType.zonkTcTyVar, we short-circuit (Indirect ty) to
+ (Indirect zty), see Note [Sharing in zonking] in GHC.Tc.Utils.TcMType. But we
/can't/ do this when zonking a TcType to a Type (#15552, esp
comment:3). Suppose we have
@@ -1706,10 +1704,10 @@ Problem:
By "knot-tied" I mean that the occurrence of T is currently a TcTyCon,
but the global env contains a mapping "T" :-> T{knot-tied-tc}. See
Note [Type checking recursive type and class declarations] in
- TcTyClsDecls.
+ GHC.Tc.TyCl.
Now we call zonkTcTypeToType on that (alpha -> alpha). If we follow
- the same path as Note [Sharing in zonking] in TcMType, we'll
+ the same path as Note [Sharing in zonking] in GHC.Tc.Utils.TcMType, we'll
update alpha to
alpha := T{knot-tied-tc} Int -> Int
@@ -1859,7 +1857,7 @@ zonkTcTyConToTyCon tc
_ -> pprPanic "zonkTcTyCon" (ppr tc $$ ppr thing) }
| otherwise = return tc -- it's already zonked
--- Confused by zonking? See Note [What is zonking?] in TcMType.
+-- Confused by zonking? See Note [What is zonking?] in GHC.Tc.Utils.TcMType.
zonkTcTypeToType :: TcType -> TcM Type
zonkTcTypeToType ty = initZonkEnv $ \ ze -> zonkTcTypeToTypeX ze ty
diff --git a/compiler/typecheck/TcValidity.hs b/compiler/GHC/Tc/Validity.hs
index 289cf83225..2fe9d16595 100644
--- a/compiler/typecheck/TcValidity.hs
+++ b/compiler/GHC/Tc/Validity.hs
@@ -8,7 +8,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module TcValidity (
+module GHC.Tc.Validity (
Rank, UserTypeCtxt(..), checkValidType, checkValidMonoType,
checkValidTheta,
checkValidInstance, checkValidInstHead, validDerivPred,
@@ -27,13 +27,13 @@ import GhcPrelude
import Maybes
-- friends:
-import TcUnify ( tcSubType_NC )
-import TcSimplify ( simplifyAmbiguityCheck )
-import ClsInst ( matchGlobalInst, ClsInstResult(..), InstanceWhat(..), AssocInstInfo(..) )
+import GHC.Tc.Utils.Unify ( tcSubType_NC )
+import GHC.Tc.Solver ( simplifyAmbiguityCheck )
+import GHC.Tc.Instance.Class ( matchGlobalInst, ClsInstResult(..), InstanceWhat(..), AssocInstInfo(..) )
import GHC.Core.TyCo.FVs
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr
-import TcType hiding ( sizeType, sizeTypes )
+import GHC.Tc.Utils.TcType hiding ( sizeType, sizeTypes )
import TysWiredIn ( heqTyConName, eqTyConName, coercibleTyConName )
import PrelNames
import GHC.Core.Type
@@ -43,18 +43,18 @@ import GHC.Core.Coercion.Axiom
import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Core.Predicate
-import TcOrigin
+import GHC.Tc.Types.Origin
-- others:
-import GHC.Iface.Type ( pprIfaceType, pprIfaceTypeApp )
-import GHC.CoreToIface ( toIfaceTyCon, toIfaceTcArgs, toIfaceType )
-import GHC.Hs -- HsType
-import TcRnMonad -- TcType, amongst others
-import TcEnv ( tcInitTidyEnv, tcInitOpenTidyEnv )
-import FunDeps
+import GHC.Iface.Type ( pprIfaceType, pprIfaceTypeApp )
+import GHC.CoreToIface ( toIfaceTyCon, toIfaceTcArgs, toIfaceType )
+import GHC.Hs
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.Env ( tcInitTidyEnv, tcInitOpenTidyEnv )
+import GHC.Tc.Instance.FunDeps
import GHC.Core.FamInstEnv
( isDominatedBy, injectiveBranches, InjectivityCheckResult(..) )
-import FamInst
+import GHC.Tc.Instance.Family
import GHC.Types.Name
import GHC.Types.Var.Env
import GHC.Types.Var.Set
@@ -66,8 +66,8 @@ import Util
import ListSetOps
import GHC.Types.SrcLoc
import Outputable
-import GHC.Types.Unique ( mkAlphaTyVarUnique )
-import Bag ( emptyBag )
+import GHC.Types.Unique ( mkAlphaTyVarUnique )
+import Bag ( emptyBag )
import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
@@ -129,7 +129,7 @@ and fail.
So in fact we use this as our *definition* of ambiguity. We use a
very similar test for *inferred* types, to ensure that they are
-unambiguous. See Note [Impedance matching] in TcBinds.
+unambiguous. See Note [Impedance matching] in GHC.Tc.Gen.Bind.
This test is very conveniently implemented by calling
tcSubType <type> <type>
@@ -203,7 +203,7 @@ we might have
let ?x = 5::Int in foo
and all is well. In effect, implicit parameters are, well, parameters,
so we can take their type variables into account as part of the
-"tau-tvs" stuff. This is done in the function 'FunDeps.grow'.
+"tau-tvs" stuff. This is done in the function 'GHC.Tc.Instance.FunDeps.grow'.
-}
checkAmbiguity :: UserTypeCtxt -> Type -> TcM ()
@@ -1125,8 +1125,8 @@ check_pred_help under_syn env dflags ctxt pred
-- f :: (a ~# b) => blah
-- is wrong. For user written signatures, it'll be rejected by kind-checking
-- well before we get to validity checking. For inferred types we are careful
- -- to box such constraints in TcType.pickQuantifiablePreds, as described
- -- in Note [Lift equality constraints when quantifying] in TcType
+ -- to box such constraints in GHC.Tc.Utils.TcType.pickQuantifiablePreds, as described
+ -- in Note [Lift equality constraints when quantifying] in GHC.Tc.Utils.TcType
ForAllPred _ theta head -> check_quant_pred env dflags ctxt pred theta head
IrredPred {} -> check_irred_pred under_syn env dflags ctxt pred
@@ -1288,9 +1288,9 @@ checkSimplifiableClassConstraint env dflags ctxt cls tys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A type signature like
f :: Eq [(a,b)] => a -> b
-is very fragile, for reasons described at length in TcInteract
+is very fragile, for reasons described at length in GHC.Tc.Solver.Interact
Note [Instance and Given overlap]. As that Note discusses, for the
-most part the clever stuff in TcInteract means that we don't use a
+most part the clever stuff in GHC.Tc.Solver.Interact means that we don't use a
top-level instance if a local Given might fire, so there is no
fragility. But if we /infer/ the type of a local let-binding, things
can go wrong (#11948 is an example, discussed in the Note).
@@ -1302,7 +1302,7 @@ class constraints.
The warning only fires if the constraint in the signature
matches the top-level instances in only one way, and with no
unifiers -- that is, under the same circumstances that
-TcInteract.matchInstEnv fires an interaction with the top
+GHC.Tc.Solver.Interact.matchInstEnv fires an interaction with the top
level instances. For example (#13526), consider
instance {-# OVERLAPPABLE #-} Eq (T a) where ...
@@ -1499,7 +1499,7 @@ entirely different meaning. Suppose in M.hsig we see
That says that any module satisfying M.hsig must provide a KnownNat
instance for T. We absolultely need that instance when compiling a
module that imports M.hsig: see #15379 and
-Note [Fabricating Evidence for Literals in Backpack] in ClsInst.
+Note [Fabricating Evidence for Literals in Backpack] in GHC.Tc.Instance.Class.
Hence, checkValidInstHead accepts a user-written instance declaration
in hsig files, where `is_sig` is True.
@@ -1518,7 +1518,7 @@ check_special_inst_head dflags is_boot is_sig ctxt clas cls_args
-- For Typeable, don't complain about instances for
-- standalone deriving; they are no-ops, and we warn about
- -- it in TcDeriv.deriveStandalone.
+ -- it in GHC.Tc.Deriv.deriveStandalone.
| clas_nm == typeableClassName
, not is_sig
-- Note [Instances of built-in classes in signature files]
@@ -1716,7 +1716,7 @@ the middle:
Note [Validity checking of HasField instances]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The HasField class has magic constraint solving behaviour (see Note
-[HasField instances] in TcInteract). However, we permit users to
+[HasField instances] in GHC.Tc.Solver.Interact). However, we permit users to
declare their own instances, provided they do not clash with the
built-in behaviour. In particular, we forbid:
@@ -1736,7 +1736,7 @@ The usual functional dependency checks also apply.
Note [Valid 'deriving' predicate]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
validDerivPred checks for OK 'deriving' context. See Note [Exotic
-derived instance contexts] in TcDeriv. However the predicate is
+derived instance contexts] in GHC.Tc.Deriv. However the predicate is
here because it uses sizeTypes, fvTypes.
It checks for three things
@@ -2651,7 +2651,7 @@ To solve this problem in a robust way, we do the following:
1. When kind-checking, we count the number of user-written *required*
arguments and check if there is an equal number of required tycon binders.
- If not, reject. (See `wrongNumberOfParmsErr` in TcTyClsDecls.)
+ If not, reject. (See `wrongNumberOfParmsErr` in GHC.Tc.TyCl.)
We perform this step during kind-checking, not during validity checking,
since we can give better error messages if we catch it early.
@@ -2711,8 +2711,8 @@ datatype declarations. This checks for
but we don't. See Note [Ambiguous kind vars].
See also
- * Note [Required, Specified, and Inferred for types] in TcTyClsDecls.
- * Note [Checking telescopes] in Constraint discusses how
+ * Note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl.
+ * Note [Checking telescopes] in GHC.Tc.Types.Constraint discusses how
this check works for `forall x y z.` written in a type.
Note [Ambiguous kind vars]
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs
index 4eb52b4970..d2e9c3cd6e 100644
--- a/compiler/GHC/ThToHs.hs
+++ b/compiler/GHC/ThToHs.hs
@@ -1077,7 +1077,7 @@ the trees to reflect the fixities of the underlying operators:
UInfixE x * (UInfixE y + z) ---> (x * y) + z
This is done by the renamer (see @mkOppAppRn@, @mkConOppPatRn@, and
-@mkHsOpTyRn@ in GHC.Rename.Types), which expects that the input will be completely
+@mkHsOpTyRn@ in GHC.Rename.HsType), which expects that the input will be completely
right-biased for types and left-biased for everything else. So we left-bias the
trees of @UInfixP@ and @UInfixE@ and right-bias the trees of @UInfixT@.
@@ -1998,7 +1998,7 @@ with the following parts:
Due to the two forall quantifiers and constraint contexts (either of
which might be empty), pattern synonym type signatures are treated
specially in `GHC.HsToCore.Quote`, `GHC.ThToHs`, and
-`typecheck/TcSplice.hs`:
+`typecheck/GHC.Tc.Gen.Splice.hs`:
(a) When desugaring a pattern synonym from HsSyn to TH.Dec in
`GHC.HsToCore.Quote`, we represent its *full* type signature in TH, i.e.:
@@ -2015,7 +2015,7 @@ specially in `GHC.HsToCore.Quote`, `GHC.ThToHs`, and
where initial empty `univs` type variables or an empty `reqs`
constraint context are represented *explicitly* as `() =>`.
- (c) When reifying a pattern synonym in `typecheck/TcSplice.hs`, we always
+ (c) When reifying a pattern synonym in `typecheck/GHC.Tc.Gen.Splice.hs`, we always
return its *full* type, i.e.:
ForallT univs reqs (ForallT exis provs ty)
diff --git a/compiler/GHC/Types/Id/Info.hs b/compiler/GHC/Types/Id/Info.hs
index 9f3b192848..af1ebb18cd 100644
--- a/compiler/GHC/Types/Id/Info.hs
+++ b/compiler/GHC/Types/Id/Info.hs
@@ -139,7 +139,7 @@ data IdDetails
{ sel_tycon :: RecSelParent
, sel_naughty :: Bool -- True <=> a "naughty" selector which can't actually exist, for example @x@ in:
-- data T = forall a. MkT { x :: a }
- } -- See Note [Naughty record selectors] in TcTyClsDecls
+ } -- See Note [Naughty record selectors] in GHC.Tc.TyCl
| DataConWorkId DataCon -- ^ The 'Id' is for a data constructor /worker/
| DataConWrapId DataCon -- ^ The 'Id' is for a data constructor /wrapper/
diff --git a/compiler/GHC/Types/Id/Make.hs b/compiler/GHC/Types/Id/Make.hs
index 58a02f2f3d..052345f3c9 100644
--- a/compiler/GHC/Types/Id/Make.hs
+++ b/compiler/GHC/Types/Id/Make.hs
@@ -49,7 +49,7 @@ import GHC.Core.Type
import GHC.Core.TyCo.Rep
import GHC.Core.FamInstEnv
import GHC.Core.Coercion
-import TcType
+import GHC.Tc.Utils.TcType as TcType
import GHC.Core.Make
import GHC.Core.FVs ( mkRuleInfo )
import GHC.Core.Utils ( mkCast, mkDefaultCase )
@@ -420,14 +420,14 @@ mkDictSelId name clas
= base_info `setInlinePragInfo` alwaysInlinePragma
`setUnfoldingInfo` mkInlineUnfoldingWithArity 1
(mkDictSelRhs clas val_index)
- -- See Note [Single-method classes] in TcInstDcls
+ -- See Note [Single-method classes] in GHC.Tc.TyCl.Instance
-- for why alwaysInlinePragma
| otherwise
= base_info `setRuleInfo` mkRuleInfo [rule]
-- Add a magic BuiltinRule, but no unfolding
-- so that the rule is always available to fire.
- -- See Note [ClassOp/DFun selection] in TcInstDcls
+ -- See Note [ClassOp/DFun selection] in GHC.Tc.TyCl.Instance
-- This is the built-in rule that goes
-- op (dfT d1 d2) ---> opT d1 d2
@@ -1187,7 +1187,7 @@ wrapNewTypeBody tycon args result_expr
-- When unwrapping, we do *not* apply any family coercion, because this will
-- be done via a CoPat by the type checker. We have to do it this way as
-- computing the right type arguments for the coercion requires more than just
--- a splitting operation (cf, TcPat.tcConPat).
+-- a splitting operation (cf, GHC.Tc.Gen.Pat.tcConPat).
unwrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
unwrapNewTypeBody tycon args result_expr
@@ -1298,7 +1298,7 @@ mkDictFunId :: Name -- Name to use for the dict fun;
-> Class
-> [Type]
-> Id
--- Implements the DFun Superclass Invariant (see TcInstDcls)
+-- Implements the DFun Superclass Invariant (see GHC.Tc.TyCl.Instance)
-- See Note [Dict funs and default methods]
mkDictFunId dfun_name tvs theta clas tys
@@ -1477,7 +1477,7 @@ b) It has quite a bit of desugaring magic.
c) There is some special rule handing: Note [User-defined RULES for seq]
Historical note:
- In TcExpr we used to need a special typing rule for 'seq', to handle calls
+ In GHC.Tc.Gen.Expr we used to need a special typing rule for 'seq', to handle calls
whose second argument had an unboxed type, e.g. x `seq` 3#
However, with levity polymorphism we can now give seq the type seq ::
diff --git a/compiler/GHC/Types/Name/Occurrence.hs b/compiler/GHC/Types/Name/Occurrence.hs
index d57924e121..c54770be13 100644
--- a/compiler/GHC/Types/Name/Occurrence.hs
+++ b/compiler/GHC/Types/Name/Occurrence.hs
@@ -597,7 +597,7 @@ isDefaultMethodOcc occ =
-- | Is an 'OccName' one of a Typeable @TyCon@ or @Module@ binding?
-- This is needed as these bindings are renamed differently.
--- See Note [Grand plan for Typeable] in TcTypeable.
+-- See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.
isTypeableBindOcc :: OccName -> Bool
isTypeableBindOcc occ =
case occNameString occ of
@@ -639,7 +639,7 @@ mkCon2TagOcc = mk_simple_deriv varName "$con2tag_"
mkTag2ConOcc = mk_simple_deriv varName "$tag2con_"
mkMaxTagOcc = mk_simple_deriv varName "$maxtag_"
--- TyConRepName stuff; see Note [Grand plan for Typeable] in TcTypeable
+-- TyConRepName stuff; see Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable
mkTyConRepOcc occ = mk_simple_deriv varName prefix occ
where
prefix | isDataOcc occ = "$tc'"
@@ -729,7 +729,7 @@ We used to add a '$m' to indicate a method, but that gives rise to bad
error messages from the type checker when we print the function name or pattern
of an instance-decl binding. Why? Because the binding is zapped
to use the method name in place of the selector name.
-(See TcClassDcl.tcMethodBind)
+(See GHC.Tc.TyCl.Class.tcMethodBind)
The way it is now, -ddump-xx output may look confusing, but
you can always say -dppr-debug to get the uniques.
diff --git a/compiler/GHC/Types/Name/Reader.hs b/compiler/GHC/Types/Name/Reader.hs
index d183979372..e2ef941723 100644
--- a/compiler/GHC/Types/Name/Reader.hs
+++ b/compiler/GHC/Types/Name/Reader.hs
@@ -416,7 +416,7 @@ Note [Local bindings with Exact Names]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With Template Haskell we can make local bindings that have Exact Names.
Computing shadowing etc may use elemLocalRdrEnv (at least it certainly
-does so in GHC.Rename.Types.bindHsQTyVars), so for an Exact Name we must consult
+does so in GHC.Rename.HsType.bindHsQTyVars), so for an Exact Name we must consult
the in-scope-name-set.
diff --git a/compiler/GHC/Types/Name/Shape.hs b/compiler/GHC/Types/Name/Shape.hs
index 39a25c1ad6..be89bf349c 100644
--- a/compiler/GHC/Types/Name/Shape.hs
+++ b/compiler/GHC/Types/Name/Shape.hs
@@ -24,7 +24,7 @@ import GHC.Types.FieldLabel
import GHC.Types.Name
import GHC.Types.Name.Env
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import Util
import GHC.Iface.Env
@@ -59,8 +59,8 @@ import Control.Monad
--- The 'NameShape' type is defined in TcRnTypes, because TcRnTypes
--- needs to refer to NameShape, and having TcRnTypes import
+-- The 'NameShape' type is defined in GHC.Tc.Types, because GHC.Tc.Types
+-- needs to refer to NameShape, and having GHC.Tc.Types import
-- NameShape (even by SOURCE) would cause a large number of
-- modules to be pulled into the DynFlags cycle.
{-
diff --git a/compiler/GHC/Types/Var.hs b/compiler/GHC/Types/Var.hs
index 267d0fc786..0f91cfd08c 100644
--- a/compiler/GHC/Types/Var.hs
+++ b/compiler/GHC/Types/Var.hs
@@ -93,7 +93,7 @@ import GhcPrelude
import {-# SOURCE #-} GHC.Core.TyCo.Rep( Type, Kind )
import {-# SOURCE #-} GHC.Core.TyCo.Ppr( pprKind )
-import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv )
+import {-# SOURCE #-} GHC.Tc.Utils.TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv )
import {-# SOURCE #-} GHC.Types.Id.Info( IdDetails, IdInfo, coVarDetails, isCoVarDetails,
vanillaIdInfo, pprIdDetails )
@@ -611,7 +611,7 @@ mkTyVar name kind = TyVar { varName = name
mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
mkTcTyVar name kind details
- = -- NB: 'kind' may be a coercion kind; cf, 'TcMType.newMetaCoVar'
+ = -- NB: 'kind' may be a coercion kind; cf, 'GHC.Tc.Utils.TcMType.newMetaCoVar'
TcTyVar { varName = name,
realUnique = getKey (nameUnique name),
varType = kind,
@@ -619,7 +619,7 @@ mkTcTyVar name kind details
}
tcTyVarDetails :: TyVar -> TcTyVarDetails
--- See Note [TcTyVars in the typechecker] in TcType
+-- See Note [TcTyVars in the typechecker] in GHC.Tc.Utils.TcType
tcTyVarDetails (TcTyVar { tc_tv_details = details }) = details
tcTyVarDetails (TyVar {}) = vanillaSkolemTv
tcTyVarDetails var = pprPanic "tcTyVarDetails" (ppr var <+> dcolon <+> pprKind (tyVarKind var))
diff --git a/compiler/typecheck/Flattening-notes b/compiler/flattening-notes
index 2aa9243743..2aa9243743 100644
--- a/compiler/typecheck/Flattening-notes
+++ b/compiler/flattening-notes
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index c3a1aa5424..a6292f5d5a 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -346,7 +346,7 @@ Library
GHC.Hs.Dump
GHC.Iface.Binary
BinFingerprint
- BuildTyCl
+ GHC.Tc.TyCl.Build
GHC.Iface.Env
GHC.Iface.Syntax
GHC.Iface.Type
@@ -383,7 +383,7 @@ Library
GHC.Driver.Packages
PlatformConstants
GHC.Driver.Plugins
- TcPluginM
+ GHC.Tc.Plugin
GHC.Core.Ppr.TyThing
Settings
StaticPtrTable
@@ -415,15 +415,15 @@ Library
TysWiredIn
GHC.Types.CostCentre
GHC.Types.CostCentre.State
- GHC.Rename.Binds
+ GHC.Rename.Bind
GHC.Rename.Env
GHC.Rename.Expr
GHC.Rename.Doc
GHC.Rename.Names
GHC.Rename.Pat
- GHC.Rename.Source
+ GHC.Rename.Module
GHC.Rename.Splice
- GHC.Rename.Types
+ GHC.Rename.HsType
GHC.Rename.Fixity
GHC.Rename.Utils
GHC.Rename.Unbound
@@ -464,63 +464,63 @@ Library
GHC.Core.Op.Exitify
GHC.Core.Op.WorkWrap
GHC.Core.Op.WorkWrap.Lib
- FamInst
- ClsInst
- Inst
- TcAnnotations
- TcArrows
- TcBinds
- TcSigs
- TcClassDcl
- TcDefaults
- TcDeriv
- TcDerivInfer
- TcDerivUtils
- TcEnv
- TcExpr
- TcForeign
- TcGenDeriv
- TcGenFunctor
- TcGenGenerics
- TcHsSyn
- TcHsType
- TcInstDcls
- TcMType
- TcValidity
- TcMatches
- TcPat
- TcPatSyn
- TcRnDriver
- TcBackpack
- TcRnExports
- TcRnMonad
- TcRnTypes
- Constraint
- TcOrigin
- TcRules
- TcSimplify
- TcHoleErrors
- TcHoleFitTypes
- TcErrors
- TcTyClsDecls
- TcTyDecls
- TcTypeable
- TcType
- TcEvidence
- TcEvTerm
- TcUnify
- TcInteract
- TcCanonical
- TcFlatten
- TcSMonad
+ GHC.Tc.Instance.Family
+ GHC.Tc.Instance.Class
+ GHC.Tc.Utils.Instantiate
+ GHC.Tc.Gen.Annotation
+ GHC.Tc.Gen.Arrow
+ GHC.Tc.Gen.Bind
+ GHC.Tc.Gen.Sig
+ GHC.Tc.TyCl.Class
+ GHC.Tc.Gen.Default
+ GHC.Tc.Deriv
+ GHC.Tc.Deriv.Infer
+ GHC.Tc.Deriv.Utils
+ GHC.Tc.Utils.Env
+ GHC.Tc.Gen.Expr
+ GHC.Tc.Gen.Foreign
+ GHC.Tc.Deriv.Generate
+ GHC.Tc.Deriv.Functor
+ GHC.Tc.Deriv.Generics
+ GHC.Tc.Utils.Zonk
+ GHC.Tc.Utils.TcType
+ GHC.Tc.TyCl.Instance
+ GHC.Tc.Utils.TcMType
+ GHC.Tc.Validity
+ GHC.Tc.Gen.Match
+ GHC.Tc.Gen.Pat
+ GHC.Tc.TyCl.PatSyn
+ GHC.Tc.Module
+ GHC.Tc.Utils.Backpack
+ GHC.Tc.Gen.Export
+ GHC.Tc.Utils.Monad
+ GHC.Tc.Types
+ GHC.Tc.Types.Constraint
+ GHC.Tc.Types.Origin
+ GHC.Tc.Gen.Rule
+ GHC.Tc.Errors.Hole
+ GHC.Tc.Errors.Hole.FitTypes
+ GHC.Tc.Errors
+ GHC.Tc.TyCl
+ GHC.Tc.TyCl.Utils
+ GHC.Tc.Instance.Typeable
+ GHC.Tc.Gen.HsType
+ GHC.Tc.Types.Evidence
+ GHC.Tc.Types.EvTerm
+ GHC.Tc.Utils.Unify
+ GHC.Tc.Solver
+ GHC.Tc.Solver.Interact
+ GHC.Tc.Solver.Canonical
+ GHC.Tc.Solver.Flatten
+ GHC.Tc.Solver.Monad
TcTypeNats
- TcSplice
+ GHC.Tc.Gen.Splice
GHC.Core.Class
GHC.Core.Coercion
GHC.HsToCore.Quote
THNames
GHC.Core.FamInstEnv
- FunDeps
+ GHC.Tc.Instance.FunDeps
GHC.Core.InstEnv
GHC.Core.TyCon
GHC.Core.Coercion.Axiom
diff --git a/compiler/main/StaticPtrTable.hs b/compiler/main/StaticPtrTable.hs
index 24bb7c974f..15214f2ad6 100644
--- a/compiler/main/StaticPtrTable.hs
+++ b/compiler/main/StaticPtrTable.hs
@@ -65,7 +65,7 @@ Here is a running example:
* The typechecker verifies that all free variables occurring in the
static form are floatable to top level (see Note [Meaning of
- IdBindingInfo] in TcRnTypes). In our example, 'k' is floatable.
+ IdBindingInfo] in GHC.Tc.Types). In our example, 'k' is floatable.
Even though it is bound in a nested let, we are fine.
* The desugarer replaces the static form with an application of the
@@ -137,7 +137,7 @@ import GHC.Types.Name
import Outputable
import GHC.Platform
import PrelNames
-import TcEnv (lookupGlobal)
+import GHC.Tc.Utils.Env (lookupGlobal)
import GHC.Core.Type
import Control.Monad.Trans.Class (lift)
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index a99a62913e..1536b85bca 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -940,7 +940,7 @@ One might think that we wish to treat 'family' and 'role' as regular old
varids whenever -XTypeFamilies and -XRoleAnnotations are off, respectively.
But, there is no need to do so. These pseudo-keywords are not stolen syntax:
they are only used after the keyword 'type' at the top-level, where varids are
-not allowed. Furthermore, checks further downstream (TcTyClsDecls) ensure that
+not allowed. Furthermore, checks further downstream (GHC.Tc.TyCl) ensure that
type families and role annotations are never declared without their extensions
on. In fact, by unconditionally lexing these pseudo-keywords as special, we
can get better error messages.
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index e87cad6dae..842a912b0e 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -44,10 +44,9 @@ import Control.Monad ( mplus )
import Control.Applicative ((<$))
import qualified Prelude
--- compiler/hsSyn
+-- compiler
import GHC.Hs
--- compiler/main
import GHC.Driver.Phases ( HscSource(..) )
import GHC.Driver.Types ( IsBootInterface, WarningTxt(..) )
import GHC.Driver.Session
@@ -60,6 +59,8 @@ import BooleanFormula ( BooleanFormula(..), LBooleanFormula(..), mkTrue )
import FastString
import Maybes ( isJust, orElse )
import Outputable
+import Util ( looksLikePackageName, fstOf3, sndOf3, thdOf3 )
+import GhcPrelude
-- compiler/basicTypes
import GHC.Types.Name.Reader
@@ -68,8 +69,8 @@ import GHC.Core.DataCon ( DataCon, dataConName )
import GHC.Types.SrcLoc
import GHC.Types.Module
import GHC.Types.Basic
+import GHC.Types.ForeignCall
--- compiler/types
import GHC.Core.Type ( funTyCon )
import GHC.Core.Class ( FunDep )
@@ -79,19 +80,13 @@ import Lexer
import HaddockUtils
import ApiAnnotation
--- compiler/typecheck
-import TcEvidence ( emptyTcEvBinds )
+import GHC.Tc.Types.Evidence ( emptyTcEvBinds )
-- compiler/prelude
-import GHC.Types.ForeignCall
import TysPrim ( eqPrimTyCon )
import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleDataCon, nilDataCon,
unboxedUnitTyCon, unboxedUnitDataCon,
listTyCon_RDR, consDataCon_RDR, eqTyCon_RDR )
-
--- compiler/utils
-import Util ( looksLikePackageName, fstOf3, sndOf3, thdOf3 )
-import GhcPrelude
}
%expect 232 -- shift/reduce conflicts
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
index 8452ac734c..583cbf9c44 100644
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -1291,7 +1291,7 @@ mkTrFunName = varQual tYPEABLE_INTERNAL (fsLit "mkTrFun") mkTrF
typeNatTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeNatTypeRep") typeNatTypeRepKey
typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey
-- this is the Typeable 'Module' for GHC.Prim (which has no code, so we place in GHC.Types)
--- See Note [Grand plan for Typeable] in TcTypeable.
+-- See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.
trGhcPrimModuleName = varQual gHC_TYPES (fsLit "tr$ModuleGHCPrim") trGhcPrimModuleKey
-- Typeable KindReps for some common cases
@@ -1620,11 +1620,11 @@ datatypeClassKey = mkPreludeClassUnique 39
constructorClassKey = mkPreludeClassUnique 40
selectorClassKey = mkPreludeClassUnique 41
--- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in TcEvidence
+-- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
knownNatClassNameKey :: Unique
knownNatClassNameKey = mkPreludeClassUnique 42
--- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in TcEvidence
+-- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
knownSymbolClassNameKey :: Unique
knownSymbolClassNameKey = mkPreludeClassUnique 43
@@ -2451,7 +2451,7 @@ standardClassKeys = derivableClassKeys ++ numericClassKeys
{-
@derivableClassKeys@ is also used in checking \tr{deriving} constructs
-(@TcDeriv@).
+(@GHC.Tc.Deriv@).
-}
derivableClassKeys :: [Unique]
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 422ed27fe1..a5f17870f9 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -708,7 +708,7 @@ Type.classifyPredType.
All wanted constraints of this type are built with coercion holes.
(See Note [Coercion holes] in GHC.Core.TyCo.Rep.) But see also
-Note [Deferred errors for coercion holes] in TcErrors to see how
+Note [Deferred errors for coercion holes] in GHC.Tc.Errors to see how
equality constraints are deferred.
Within GHC, ~# is called eqPrimTyCon, and it is defined in TysPrim.
@@ -732,7 +732,7 @@ Here's what's unusual about it:
solve a goal of type (a ~~ b) even if there is, say (Int ~~ c) in the
context. (Normally, it waits to learn more, just in case the given
influences what happens next.) See Note [Naturally coherent classes]
- in TcInteract.
+ in GHC.Tc.Solver.Interact.
* It always terminates. That is, in the UndecidableInstances checks, we
don't worry if a (~~) constraint is too big, as we know that solving
@@ -741,7 +741,7 @@ Here's what's unusual about it:
On the other hand, this behaves just like any class w.r.t. eager superclass
unpacking in the solver. So a lifted equality given quickly becomes an unlifted
equality given. This is good, because the solver knows all about unlifted
-equalities. There is some special-casing in TcInteract.matchClassInst to
+equalities. There is some special-casing in GHC.Tc.Solver.Interact.matchClassInst to
pretend that there is an instance of this class, as we can't write the instance
in Haskell.
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 8db8379131..4bf7ad6642 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -679,7 +679,7 @@ Note [How tuples work] See also Note [Known-key names] in PrelNames
- Given constraints: the superclasses automatically become available
- Wanted constraints: there is a built-in instance
instance (c1,c2) => (c1,c2)
- See TcInteract.matchCTuple
+ See GHC.Tc.Solver.Interact.matchCTuple
- Currently just go up to 62; beyond that
you have to use manual nesting
- Their OccNames look like (%,,,%), so they can easily be
@@ -730,7 +730,7 @@ nothing special about one-tuples in Core; in particular, they have no
custom pretty-printing, just using `Unit`.
Note that there is *not* a unary constraint tuple, unlike for other forms of
-tuples. See [Ignore unary constraint tuples] in TcHsType for more
+tuples. See [Ignore unary constraint tuples] in GHC.Tc.Gen.HsType for more
details.
See also Note [Flattening one-tuples] in GHC.Core.Make and
diff --git a/compiler/typecheck/TcEnv.hs-boot b/compiler/typecheck/TcEnv.hs-boot
deleted file mode 100644
index 23278b8d34..0000000000
--- a/compiler/typecheck/TcEnv.hs-boot
+++ /dev/null
@@ -1,10 +0,0 @@
-module TcEnv where
-
-import TcRnTypes( TcM )
-import GHC.Types.Var.Env( TidyEnv )
-
--- Annoyingly, there's a recursion between tcInitTidyEnv
--- (which does zonking and hence needs TcMType) and
--- addErrTc etc which live in TcRnMonad. Rats.
-tcInitTidyEnv :: TcM TidyEnv
-
diff --git a/compiler/typecheck/TcHoleErrors.hs-boot b/compiler/typecheck/TcHoleErrors.hs-boot
deleted file mode 100644
index 9c5df86489..0000000000
--- a/compiler/typecheck/TcHoleErrors.hs-boot
+++ /dev/null
@@ -1,13 +0,0 @@
--- This boot file is in place to break the loop where:
--- + TcSimplify calls 'TcErrors.reportUnsolved',
--- + which calls 'TcHoleErrors.findValidHoleFits`
--- + which calls 'TcSimplify.simpl_top'
-module TcHoleErrors where
-
-import TcRnTypes ( TcM )
-import Constraint ( Ct, Implication )
-import Outputable ( SDoc )
-import GHC.Types.Var.Env ( TidyEnv )
-
-findValidHoleFits :: TidyEnv -> [Implication] -> [Ct] -> Ct
- -> TcM (TidyEnv, SDoc)
diff --git a/compiler/typecheck/TcHoleFitTypes.hs-boot b/compiler/typecheck/TcHoleFitTypes.hs-boot
deleted file mode 100644
index fde064e51a..0000000000
--- a/compiler/typecheck/TcHoleFitTypes.hs-boot
+++ /dev/null
@@ -1,10 +0,0 @@
--- This boot file is in place to break the loop where:
--- + TcRnTypes needs 'HoleFitPlugin',
--- + which needs 'TcHoleFitTypes'
--- + which needs 'TcRnTypes'
-module TcHoleFitTypes where
-
--- Build ordering
-import GHC.Base()
-
-data HoleFitPlugin
diff --git a/compiler/typecheck/TcTypeNats.hs b/compiler/typecheck/TcTypeNats.hs
index 9dc1176cf2..12ec08f89f 100644
--- a/compiler/typecheck/TcTypeNats.hs
+++ b/compiler/typecheck/TcTypeNats.hs
@@ -25,11 +25,11 @@ import GhcPrelude
import GHC.Core.Type
import Pair
-import TcType ( TcType, tcEqType )
+import GHC.Tc.Utils.TcType ( TcType, tcEqType )
import GHC.Core.TyCon ( TyCon, FamTyConFlav(..), mkFamilyTyCon
, Injectivity(..) )
import GHC.Core.Coercion ( Role(..) )
-import Constraint ( Xi )
+import GHC.Tc.Types.Constraint ( Xi )
import GHC.Core.Coercion.Axiom ( CoAxiomRule(..), BuiltInSynFamily(..), TypeEqn )
import GHC.Types.Name ( Name, BuiltInSyntax(..) )
import TysWiredIn
diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs
index af8ab4a897..50e53b98c8 100644
--- a/compiler/utils/MonadUtils.hs
+++ b/compiler/utils/MonadUtils.hs
@@ -88,7 +88,7 @@ zipWith4M f xs ys ws zs = sequenceA (zipWith4 f xs ys ws zs)
zipWithAndUnzipM :: Monad m
=> (a -> b -> m (c, d)) -> [a] -> [b] -> m ([c], [d])
{-# INLINABLE zipWithAndUnzipM #-}
--- See Note [flatten_args performance] in TcFlatten for why this
+-- See Note [flatten_args performance] in GHC.Tc.Solver.Flatten for why this
-- pragma is essential.
zipWithAndUnzipM f (x:xs) (y:ys)
= do { (c, d) <- f x y
diff --git a/docs/core-spec/CoreLint.ott b/docs/core-spec/CoreLint.ott
index 3004802ad4..9ce8584f9a 100644
--- a/docs/core-spec/CoreLint.ott
+++ b/docs/core-spec/CoreLint.ott
@@ -389,7 +389,7 @@ G |-co g0 : t1 {subst1(k)}~R subst2(k) t2
G |-axk [ namesroles, n_R |-> gs, g0 ] ~> (subst1 [n |-> t1], subst2 [n |-> t2])
defn validRoles T :: :: checkValidRoles :: 'Cvr_'
- {{ com Type constructor role validity, \coderef{typecheck/TcTyClsDecls.hs}{checkValidRoles} }}
+ {{ com Type constructor role validity, \coderef{GHC/Tc/TyCl.hs}{checkValidRoles} }}
by
</ Ki // i /> = tyConDataCons T
@@ -399,7 +399,7 @@ by
validRoles T
defn validDcRoles </ Raa // aa /> K :: :: check_dc_roles :: 'Cdr_'
- {{ com Data constructor role validity, \coderef{typecheck/TcTyClsDecls.hs}{check\_dc\_roles} }}
+ {{ com Data constructor role validity, \coderef{GHC/Tc/TyCl.hs}{check\_dc\_roles} }}
by
forall </ naa // aa />. forall </ mbb // bb />. </ tcc // cc /> $ -> T </ naa // aa /> = dataConRepType K
@@ -408,7 +408,7 @@ forall </ naa // aa />. forall </ mbb // bb />. </ tcc // cc /> $ -> T </ naa //
validDcRoles </ Raa // aa /> K
defn O |- t : R :: :: check_ty_roles :: 'Ctr_'
- {{ com Type role validity, \coderef{typecheck/TcTyClsDecls.hs}{check\_ty\_roles} }}
+ {{ com Type role validity, \coderef{GHC/Tc/TyCl.hs}{check\_ty\_roles} }}
{{ tex [[O]] \labeledjudge{ctr} [[t]] : [[R]] }}
by
diff --git a/docs/core-spec/core-spec.mng b/docs/core-spec/core-spec.mng
index ea488921be..86db025586 100644
--- a/docs/core-spec/core-spec.mng
+++ b/docs/core-spec/core-spec.mng
@@ -530,7 +530,7 @@ $[[tyConRoles]]$, but with an arbitrary number of $[[Nom]]$ at the end, to accou
for potential oversaturation.
The checks encoded in the following
-judgments are run from \coderef{typecheck/TcTyClsDecls.hs}{checkValidTyCon}
+judgments are run from \coderef{GHC/Tc/TyCl.hs}{checkValidTyCon}
when \texttt{-dcore-lint} is set.
\ottdefncheckValidRoles{}
diff --git a/docs/ghci/ghci.tex b/docs/ghci/ghci.tex
index e102cdadd9..49e373a4bd 100644
--- a/docs/ghci/ghci.tex
+++ b/docs/ghci/ghci.tex
@@ -600,7 +600,7 @@ post-typechecking environment created by compiling a module.
= ModDetails {
moduleExports :: Avails
moduleEnv :: GlobalRdrEnv -- == FM RdrName [Name]
- typeEnv :: FM Name TyThing -- TyThing is in TcEnv.lhs
+ typeEnv :: FM Name TyThing -- TyThing is in GHC.Tc.Utils.Env
instEnv :: InstEnv
fixityEnv :: FM Name Fixity
ruleEnv :: FM Id [Rule]
diff --git a/docs/users_guide/extending_ghc.rst b/docs/users_guide/extending_ghc.rst
index 737a40c14b..576b9ec2fc 100644
--- a/docs/users_guide/extending_ghc.rst
+++ b/docs/users_guide/extending_ghc.rst
@@ -768,7 +768,7 @@ displayed.
import GHC.Driver.Session (getDynFlags)
import GHC.Driver.Plugins
import GHC.Driver.Types
- import TcRnTypes
+ import GHC.Tc.Types
import GHC.Hs.Extension
import GHC.Hs.Decls
import GHC.Hs.Expr
@@ -963,9 +963,9 @@ spent on searching for valid hole fits, after which new searches are aborted.
import Data.List (stripPrefix, sortOn)
- import TcRnTypes
+ import GHC.Tc.Types
- import TcRnMonad
+ import GHC.Tc.Utils.Monad
import Data.Time (UTCTime, NominalDiffTime)
import qualified Data.Time as Time
@@ -1315,7 +1315,7 @@ this idea can be seen below:
import GHC.Hs.Extension
import GHC.Hs.Lit
import Hooks
- import TcRnMonad
+ import GHC.Tc.Utils.Monad
plugin :: Plugin
plugin = defaultPlugin { dynflagsPlugin = hooksP }
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 2472b80897..87b6f597cd 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -1172,7 +1172,7 @@ runStmt input step = do
-- In GHCi, we disable `-fdefer-type-errors`, as well as `-fdefer-type-holes`
-- and `-fdefer-out-of-scope-variables` for **naked expressions**. The
-- declarations and statements are not affected.
- -- See Note [Deferred type errors in GHCi] in typecheck/TcRnDriver.hs
+ -- See Note [Deferred type errors in GHCi] in GHC.Tc.Module
st <- getGHCiState
let source = progname st
let line = line_number st
@@ -2104,7 +2104,7 @@ exceptT :: Applicative m => Either e a -> ExceptT e m a
exceptT = ExceptT . pure
-----------------------------------------------------------------------------
--- | @:type@ command. See also Note [TcRnExprMode] in TcRnDriver.
+-- | @:type@ command. See also Note [TcRnExprMode] in GHC.Tc.Module.
typeOfExpr :: GHC.GhcMonad m => String -> m ()
typeOfExpr str = handleSourceError GHC.printException $ do
diff --git a/ghc/GHCi/UI/Info.hs b/ghc/GHCi/UI/Info.hs
index bf941a208d..f5df1edc38 100644
--- a/ghc/GHCi/UI/Info.hs
+++ b/ghc/GHCi/UI/Info.hs
@@ -41,7 +41,7 @@ import GHC.Types.Name
import GHC.Types.Name.Set
import Outputable
import GHC.Types.SrcLoc
-import TcHsSyn
+import GHC.Tc.Utils.Zonk
import GHC.Types.Var
-- | Info about a module. This information is generated every time a
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 3552133891..4ea0aebd31 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -67,7 +67,7 @@ import MonadUtils ( liftIO )
-- Imports for --abi-hash
import GHC.Iface.Load ( loadUserInterface )
import GHC.Driver.Finder ( findImportedModule, cannotFindModule )
-import TcRnMonad ( initIfaceCheck )
+import GHC.Tc.Utils.Monad ( initIfaceCheck )
import Binary ( openBinMem, put_ )
import BinFingerprint ( fingerprintBinMem )
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 4ccbd5fd52..274efb8ade 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -934,7 +934,7 @@ mkTyCon# pkg modl name n_kinds kind_rep
(unpackCStringUtf8# name)
-- it is extremely important that this fingerprint computation
--- remains in sync with that in TcTypeable to ensure that type
+-- remains in sync with that in GHC.Tc.Instance.Typeable to ensure that type
-- equality is correct.
-- | Exquisitely unsafe.
@@ -954,7 +954,7 @@ mkTyCon pkg modl name (I# n_kinds) kind_rep
fingerprint :: Fingerprint
fingerprint = mkTyConFingerprint pkg modl name
--- This must match the computation done in TcTypeable.mkTyConRepTyConRHS.
+-- This must match the computation done in GHC.Tc.Instance.Typeable.mkTyConRepTyConRHS.
mkTyConFingerprint :: String -- ^ package name
-> String -- ^ module name
-> String -- ^ tycon name
diff --git a/libraries/base/GHC/OverloadedLabels.hs b/libraries/base/GHC/OverloadedLabels.hs
index df0cde2f57..576c01ce9d 100644
--- a/libraries/base/GHC/OverloadedLabels.hs
+++ b/libraries/base/GHC/OverloadedLabels.hs
@@ -42,7 +42,7 @@
-- optional id for the 'fromLabel' function to use (if
-- RebindableSyntax is enabled) . The type-checker transforms it into
-- a call to 'fromLabel'. See Note [Type-checking overloaded labels]
--- in TcExpr for more details in how type-checking works.
+-- in GHC.Tc.Gen.Expr for more details in how type-checking works.
module GHC.OverloadedLabels
( IsLabel(..)
diff --git a/libraries/base/GHC/Ptr.hs b/libraries/base/GHC/Ptr.hs
index 808dabe11b..00e226bbb3 100644
--- a/libraries/base/GHC/Ptr.hs
+++ b/libraries/base/GHC/Ptr.hs
@@ -91,7 +91,7 @@ minusPtr (Ptr a1) (Ptr a2) = I# (minusAddr# a1 a2)
-- 'FunPtr' has a phantom role for similar reasons to 'Ptr'. Note
-- that 'FunPtr's role cannot become nominal without changes elsewhere
--- in GHC. See Note [FFI type roles] in TcForeign.
+-- in GHC. See Note [FFI type roles] in GHC.Tc.Gen.Foreign.
type role FunPtr phantom
data FunPtr a = FunPtr Addr# deriving (Eq, Ord)
-- ^ A value of type @'FunPtr' a@ is a pointer to a function callable
diff --git a/libraries/base/GHC/Read.hs b/libraries/base/GHC/Read.hs
index 14e4a9b7e2..1057300c28 100644
--- a/libraries/base/GHC/Read.hs
+++ b/libraries/base/GHC/Read.hs
@@ -411,7 +411,7 @@ readSymField fieldName readVal = do
-- Note [Why readField]
--
-- Previously, the code for automatically deriving Read instance (in
--- typecheck/TcGenDeriv.hs) would generate inline code for parsing fields;
+-- typecheck/GHC.Tc.Deriv.Generate.hs) would generate inline code for parsing fields;
-- this, however, turned out to produce massive amounts of intermediate code,
-- and produced a considerable performance hit in the code generator.
-- Since Read instances are not generally supposed to be performance critical,
diff --git a/libraries/base/Unsafe/Coerce.hs b/libraries/base/Unsafe/Coerce.hs
index bad2e5bea6..cc230facbe 100644
--- a/libraries/base/Unsafe/Coerce.hs
+++ b/libraries/base/Unsafe/Coerce.hs
@@ -207,7 +207,7 @@ There are yet more wrinkles
care about fast execution, but (annoyingly) we /do/ care about the
GHCi debugger, and GHCi itself uses unsafeCoerce.
- Moreover, in TcRnDriver.tcGhciStmts we use unsafeCoerce#, rather
+ Moreover, in GHC.Tc.Module.tcGhciStmts we use unsafeCoerce#, rather
than the more kosher unsafeCoerce, becuase (with -O0) the latter
may not be inlined.
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 1cb3b6439d..bdd0883a37 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -191,7 +191,7 @@ type role IO representational
because this role is significant in the normalisation of FFI
types. Specifically, if this role were to become nominal (which would
be very strange, indeed!), changes elsewhere in GHC would be
-necessary. See [FFI type roles] in TcForeign. -}
+necessary. See [FFI type roles] in GHC.Tc.Gen.Foreign. -}
{- *********************************************************************
@@ -478,7 +478,7 @@ type KindBndr = Int
-- | The representation produced by GHC for conjuring up the kind of a
-- 'Data.Typeable.TypeRep'.
--- See Note [Representing TyCon kinds: KindRep] in TcTypeable.
+-- See Note [Representing TyCon kinds: KindRep] in GHC.Tc.Instance.Typeable.
data KindRep = KindRepTyConApp TyCon [KindRep]
| KindRepVar !KindBndr
| KindRepApp KindRep KindRep
diff --git a/libraries/ghci/GHCi/TH.hs b/libraries/ghci/GHCi/TH.hs
index 5351b90ef1..15d70ceb4f 100644
--- a/libraries/ghci/GHCi/TH.hs
+++ b/libraries/ghci/GHCi/TH.hs
@@ -19,7 +19,7 @@ Here is an overview of how TH works with -fexternal-interpreter.
Initialisation
~~~~~~~~~~~~~~
-GHC sends a StartTH message to the server (see TcSplice.getTHState):
+GHC sends a StartTH message to the server (see GHC.Tc.Gen.Splice.getTHState):
StartTH :: Message (RemoteRef (IORef QState))
@@ -79,7 +79,7 @@ For each splice
After typechecking
~~~~~~~~~~~~~~~~~~
-GHC sends a FinishTH message to the server (see TcSplice.finishTH).
+GHC sends a FinishTH message to the server (see GHC.Tc.Gen.Splice.finishTH).
The server runs any finalizers that were added by addModuleFinalizer.
@@ -87,8 +87,7 @@ Other Notes on TH / Remote GHCi
* Note [Remote GHCi] in compiler/ghci/GHCi.hs
* Note [External GHCi pointers] in compiler/ghci/GHCi.hs
- * Note [TH recover with -fexternal-interpreter] in
- compiler/typecheck/TcSplice.hs
+ * Note [TH recover with -fexternal-interpreter] in GHC.Tc.Gen.Splice
-}
import Prelude -- See note [Why do we import Prelude here?]
@@ -168,7 +167,7 @@ instance TH.Quasi GHCiQ where
qNewName str = ghcCmd (NewName str)
qReport isError msg = ghcCmd (Report isError msg)
- -- See Note [TH recover with -fexternal-interpreter] in TcSplice
+ -- See Note [TH recover with -fexternal-interpreter] in GHC.Tc.Gen.Splice
qRecover (GHCiQ h) a = GHCiQ $ \s -> mask $ \unmask -> do
remoteTHCall (qsPipe s) StartRecover
e <- try $ unmask $ runGHCiQ (a <* ghcCmd FailIfErrs) s
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 8054f599ea..4c8aacf97f 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -849,7 +849,7 @@ instance Lift a => Lift [a] where
lift xs = do { xs' <- mapM lift xs; return (ListE xs') }
liftString :: Quote m => String -> m Exp
--- Used in TcExpr to short-circuit the lifting for strings
+-- Used in GHC.Tc.Gen.Expr to short-circuit the lifting for strings
liftString s = return (LitE (StringL s))
-- | @since 2.15.0.0
diff --git a/testsuite/tests/dependent/should_compile/T16344b.hs b/testsuite/tests/dependent/should_compile/T16344b.hs
index 1f6fa8a00e..6b48921834 100644
--- a/testsuite/tests/dependent/should_compile/T16344b.hs
+++ b/testsuite/tests/dependent/should_compile/T16344b.hs
@@ -5,6 +5,6 @@ module T16344 where
import Data.Kind
-- This one is accepted, even though it is polymorphic-recursive.
--- See Note [No polymorphic recursion] in TcHsType
+-- See Note [No polymorphic recursion] in GHC.Tc.Gen.HsType
data T3 ka (a::ka) = forall b. MkT3 (T3 Type b)
diff --git a/testsuite/tests/dependent/should_fail/T16344a.hs b/testsuite/tests/dependent/should_fail/T16344a.hs
index cb4d1a7f21..cfc3091a04 100644
--- a/testsuite/tests/dependent/should_fail/T16344a.hs
+++ b/testsuite/tests/dependent/should_fail/T16344a.hs
@@ -6,6 +6,6 @@ import Data.Kind
-- This one is rejected, but in the typechecking phase
-- which is a bit nasty.
--- See Note [No polymorphic recursion] in TcHsType
+-- See Note [No polymorphic recursion] in GHC.Tc.Gen.HsType
data T2 ka (a::ka) = MkT2 (T2 Type a)
diff --git a/testsuite/tests/deriving/should_compile/deriving-1935.hs b/testsuite/tests/deriving/should_compile/deriving-1935.hs
index add1f73590..d33b21af13 100644
--- a/testsuite/tests/deriving/should_compile/deriving-1935.hs
+++ b/testsuite/tests/deriving/should_compile/deriving-1935.hs
@@ -1,7 +1,7 @@
{-# OPTIONS_GHC -XDeriveDataTypeable #-}
-- #1935
--- See Note [Superclasses of derived instance] in TcDeriv
+-- See Note [Superclasses of derived instance] in GHC.Tc.Deriv
{-# OPTIONS -fno-warn-redundant-constraints #-}
diff --git a/testsuite/tests/deriving/should_compile/drv003.hs b/testsuite/tests/deriving/should_compile/drv003.hs
index 6fdd763f84..13852c2294 100644
--- a/testsuite/tests/deriving/should_compile/drv003.hs
+++ b/testsuite/tests/deriving/should_compile/drv003.hs
@@ -1,6 +1,6 @@
{-# OPTIONS -fno-warn-redundant-constraints #-}
--- !!! This is the example given in TcDeriv
+-- !!! This is the example given in GHC.Tc.Deriv
--
module ShouldSucceed where
diff --git a/testsuite/tests/deriving/should_compile/drv015.hs b/testsuite/tests/deriving/should_compile/drv015.hs
index f76da45552..ea79179e68 100644
--- a/testsuite/tests/deriving/should_compile/drv015.hs
+++ b/testsuite/tests/deriving/should_compile/drv015.hs
@@ -4,7 +4,7 @@
-- instance (Show (f a), Show (g a)) => Show (Pair1 f g a)
-- and that is not Haskell 98.
--
--- See Note [Exotic derived instance contexts] in TcSimplify.
+-- See Note [Exotic derived instance contexts] in GHC.Tc.Solver.
-- The rule is simple: the context of a derived instance decl must
-- contain constraints of form (C tyvar) only, just as H98.
diff --git a/testsuite/tests/gadt/gadt9.hs b/testsuite/tests/gadt/gadt9.hs
index ab8d70d07a..849d5a23ad 100644
--- a/testsuite/tests/gadt/gadt9.hs
+++ b/testsuite/tests/gadt/gadt9.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE GADTs #-}
-- This one requires careful handling in
--- TcUnify.unifyTyConApp, to preserve rigidity.
+-- GHC.Tc.Utils.Unify.unifyTyConApp, to preserve rigidity.
module ShouldCompile where
diff --git a/testsuite/tests/ghc-api/T4891/T4891.hs b/testsuite/tests/ghc-api/T4891/T4891.hs
index f612093122..2ee3126642 100644
--- a/testsuite/tests/ghc-api/T4891/T4891.hs
+++ b/testsuite/tests/ghc-api/T4891/T4891.hs
@@ -10,10 +10,10 @@ import GHC.Exts.Heap
import GHC.Driver.Types
import GHC.Runtime.Linker
import GHC.Runtime.Heap.Inspect
-import TcEnv
+import GHC.Tc.Utils.Env
import GHC.Core.Type
-import TcRnMonad
-import TcType
+import GHC.Tc.Utils.Monad
+import GHC.Tc.Utils.TcType
import Control.Applicative
import GHC.Types.Name (getOccString)
import Unsafe.Coerce
diff --git a/testsuite/tests/ghci/should_run/tc-plugin-ghci/TcPluginGHCi.hs b/testsuite/tests/ghci/should_run/tc-plugin-ghci/TcPluginGHCi.hs
index 9d0ed01491..b16e217acd 100644
--- a/testsuite/tests/ghci/should_run/tc-plugin-ghci/TcPluginGHCi.hs
+++ b/testsuite/tests/ghci/should_run/tc-plugin-ghci/TcPluginGHCi.hs
@@ -1,6 +1,6 @@
module TcPluginGHCi where
-import TcRnMonad ( TcPlugin(..), TcPluginResult(..) )
+import GHC.Tc.Utils.Monad ( TcPlugin(..), TcPluginResult(..) )
import GHC.Driver.Plugins ( defaultPlugin, Plugin(..), CommandLineOption )
import Debug.Trace
diff --git a/testsuite/tests/indexed-types/should_compile/T2238.hs b/testsuite/tests/indexed-types/should_compile/T2238.hs
index f2407ac623..70b444985b 100644
--- a/testsuite/tests/indexed-types/should_compile/T2238.hs
+++ b/testsuite/tests/indexed-types/should_compile/T2238.hs
@@ -8,7 +8,7 @@
-- #2238
-- Notice that class CTF has just one value field, but
-- it also has an equality predicate.
--- See Note [Class newtypes and equality predicates] in BuildTyCl
+-- See Note [Class newtypes and equality predicates] in GHC.Tc.TyCl.Build
module Foo where
diff --git a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
index 62798fad39..431097454f 100644
--- a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
+++ b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
@@ -27,7 +27,7 @@ f x =
in (g1 '3', g2 undefined)
-{- This example comes from Note [Extra TcS Untouchables] in TcSimplify. It demonstrates
+{- This example comes from Note [Extra TcS Untouchables] in GHC.Tc.Solver. It demonstrates
why when floating equalities out of an implication constraint we must record the free
variables of the equalities as untouchables. With GHC 7.4.1 this program gives a Core
Lint error because of an existential escaping.
diff --git a/testsuite/tests/package/package07e.stderr b/testsuite/tests/package/package07e.stderr
index 52046fc9bf..6ee827d1bc 100644
--- a/testsuite/tests/package/package07e.stderr
+++ b/testsuite/tests/package/package07e.stderr
@@ -1,26 +1,28 @@
package07e.hs:2:1: error:
Could not find module ‘GHC.Hs.MyTypes’
- Perhaps you meant GHC.Hs.Types (needs flag -package-key ghc-8.7)
+ Perhaps you meant
+ GHC.Hs.Types (needs flag -package-key ghc-8.11.0.20200401)
+ GHC.Tc.Types (needs flag -package-key ghc-8.11.0.20200401)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package07e.hs:3:1: error:
Could not load module ‘GHC.Hs.Types’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package07e.hs:4:1: error:
Could not load module ‘GHC.Hs.Utils’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package07e.hs:5:1: error:
Could not load module ‘GHC.Types.Unique.FM’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
diff --git a/testsuite/tests/package/package08e.stderr b/testsuite/tests/package/package08e.stderr
index 1c2191be31..9e56961941 100644
--- a/testsuite/tests/package/package08e.stderr
+++ b/testsuite/tests/package/package08e.stderr
@@ -1,26 +1,28 @@
package08e.hs:2:1: error:
Could not find module ‘GHC.Hs.MyTypes’
- Perhaps you meant GHC.Hs.Types (needs flag -package-key ghc-8.7)
+ Perhaps you meant
+ GHC.Hs.Types (needs flag -package-key ghc-8.11.0.20200401)
+ GHC.Tc.Types (needs flag -package-key ghc-8.11.0.20200401)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package08e.hs:3:1: error:
Could not load module ‘GHC.Hs.Types’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package08e.hs:4:1: error:
Could not load module ‘GHC.Hs.Utils’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
package08e.hs:5:1: error:
Could not load module ‘GHC.Types.Unique.FM’
- It is a member of the hidden package ‘ghc-8.7’.
+ It is a member of the hidden package ‘ghc-8.11.0.20200401’.
You can run ‘:set -package ghc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
diff --git a/testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs b/testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs
index 054df8af3c..168110623e 100644
--- a/testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs
+++ b/testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs
@@ -3,13 +3,13 @@ module HoleFitPlugin where
import GHC.Plugins hiding ((<>))
-import TcHoleErrors
+import GHC.Tc.Errors.Hole
import Data.List (stripPrefix, sortOn)
-import Constraint
+import GHC.Tc.Types.Constraint
-import TcRnMonad
+import GHC.Tc.Utils.Monad
import Text.Read
diff --git a/testsuite/tests/plugins/hooks-plugin/Hooks/Plugin.hs b/testsuite/tests/plugins/hooks-plugin/Hooks/Plugin.hs
index 1e047eea7e..a74ac8cac3 100644
--- a/testsuite/tests/plugins/hooks-plugin/Hooks/Plugin.hs
+++ b/testsuite/tests/plugins/hooks-plugin/Hooks/Plugin.hs
@@ -7,7 +7,7 @@ import GHC.Hs.Expr
import GHC.Hs.Extension
import GHC.Hs.Lit
import GHC.Driver.Hooks
-import TcRnMonad
+import GHC.Tc.Utils.Monad
plugin :: Plugin
plugin = defaultPlugin { dynflagsPlugin = hooksP }
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
index 2d1c2f7eba..8ee017e61b 100644
--- a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
+++ b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
@@ -6,7 +6,7 @@ import Data.List (intercalate)
import GHC.Driver.Plugins
import Bag
import GHC.Driver.Types
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Hs.Extension
import GHC.Hs.Expr
import Outputable
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs
index d58c69f375..36ea230281 100644
--- a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs
+++ b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs
@@ -5,7 +5,7 @@ import Data.List (intercalate)
import Data.Maybe (isJust)
import GHC.Driver.Plugins
import GHC.Driver.Types
-import TcRnTypes
+import GHC.Tc.Types
import GHC.Hs.Extension
import GHC.Types.Avail
import GHC.Hs.Expr
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs
index fb5df22e7d..ecf509e40e 100644
--- a/testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs
+++ b/testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs
@@ -1,7 +1,7 @@
module Simple.TrustworthyPlugin (plugin) where
import GHC.Plugins
-import TcRnMonad
+import GHC.Tc.Utils.Monad
plugin :: Plugin
plugin = defaultPlugin
diff --git a/testsuite/tests/plugins/static-plugins.hs b/testsuite/tests/plugins/static-plugins.hs
index 3a0f3dfb08..77a5280bef 100644
--- a/testsuite/tests/plugins/static-plugins.hs
+++ b/testsuite/tests/plugins/static-plugins.hs
@@ -15,7 +15,7 @@ import GHC.Driver.Types
import Outputable
import GHC.Driver.Plugins
import System.Environment
-import TcRnTypes
+import GHC.Tc.Types
import Simple.SourcePlugin (plugin)
diff --git a/testsuite/tests/pmcheck/should_compile/T11195.hs b/testsuite/tests/pmcheck/should_compile/T11195.hs
index ff3e5ae6fa..57e2b44276 100644
--- a/testsuite/tests/pmcheck/should_compile/T11195.hs
+++ b/testsuite/tests/pmcheck/should_compile/T11195.hs
@@ -7,7 +7,7 @@ import GHC.Core.Coercion
import GHC.Core.Type hiding( substTyVarBndr, substTy, extendTCvSubst )
import GHC.Core.InstEnv
import GHC.Core.Coercion.Axiom
-import TcType ( exactTyCoVarsOfType )
+import GHC.Tc.Utils.TcType ( exactTyCoVarsOfType )
import GHC.Types.Var.Set
import GHC.Types.Var.Env
import Pair
diff --git a/testsuite/tests/polykinds/CuskFam.hs b/testsuite/tests/polykinds/CuskFam.hs
index c339dbcac0..da31a6acda 100644
--- a/testsuite/tests/polykinds/CuskFam.hs
+++ b/testsuite/tests/polykinds/CuskFam.hs
@@ -13,4 +13,4 @@ type family X :: F a
-- The type variable ‘a1’ is ambiguous
-- • In the type family declaration for ‘X’
--
- -- See Note [Unifying implicit CUSK variables] in TcHsType
+ -- See Note [Unifying implicit CUSK variables] in GHC.Tc.Gen.HsType
diff --git a/testsuite/tests/polykinds/TyVarTvKinds.hs b/testsuite/tests/polykinds/TyVarTvKinds.hs
index a3a0de3da4..cdfe115655 100644
--- a/testsuite/tests/polykinds/TyVarTvKinds.hs
+++ b/testsuite/tests/polykinds/TyVarTvKinds.hs
@@ -4,4 +4,4 @@ module TyVarTvKinds where
data T (a :: k1) x = MkT (S a ())
data S (b :: k2) y = MkS (T b ())
- -- tests TcTyClsDecls.no_sig_tv
+ -- tests GHC.Tc.TyCl.no_sig_tv
diff --git a/testsuite/tests/programs/record_upd/Main.hs b/testsuite/tests/programs/record_upd/Main.hs
index 0fd8e80ab6..da4aec7356 100644
--- a/testsuite/tests/programs/record_upd/Main.hs
+++ b/testsuite/tests/programs/record_upd/Main.hs
@@ -1,6 +1,6 @@
{- The purpose of this is to test that record update is
sufficiently polymorphic. See comments with
- tcExpr (RecordUpd) in TcExpr.lhs
+ tcExpr (RecordUpd) in GHC.Tc.Gen.Expr
-}
module Main where
diff --git a/testsuite/tests/roles/should_compile/Roles2.hs b/testsuite/tests/roles/should_compile/Roles2.hs
index 1ead5a4e94..eb6dc38f8c 100644
--- a/testsuite/tests/roles/should_compile/Roles2.hs
+++ b/testsuite/tests/roles/should_compile/Roles2.hs
@@ -3,7 +3,7 @@ module Roles2 where
import GHC.Ptr
-- these *must* have certain roles, or things break strangely
--- see TcForeign
+-- see GHC.Tc.Gen.Foreign
data T1 a = K1 (IO a)
data T2 a = K2 (FunPtr a)
diff --git a/testsuite/tests/simplCore/should_compile/T5776.hs b/testsuite/tests/simplCore/should_compile/T5776.hs
index 17a3e25852..5fab2b4ceb 100644
--- a/testsuite/tests/simplCore/should_compile/T5776.hs
+++ b/testsuite/tests/simplCore/should_compile/T5776.hs
@@ -13,7 +13,7 @@ module T5776 where
-- = GHC.Types.True
--
-- Note the *two* forall'd dEq parameters. This is important.
--- See Note [Simplifying RULE lhs constraints] in TcSimplify
+-- See Note [Simplifying RULE lhs constraints] in GHC.Tc.Solver
{-# RULES "foo" forall x y z.
f (g x y) (g y z) = True
diff --git a/testsuite/tests/typecheck/should_compile/DfltProb2.hs b/testsuite/tests/typecheck/should_compile/DfltProb2.hs
index 8553ca4c70..2dc6000f2b 100644
--- a/testsuite/tests/typecheck/should_compile/DfltProb2.hs
+++ b/testsuite/tests/typecheck/should_compile/DfltProb2.hs
@@ -18,6 +18,6 @@ f x = const True (\y -> let w :: a -> a
(ii) /then/ we try to default (and succeed)
(iii) then try to resolve again
- See Note [Top-level Defaulting Plan] in TcSimplify -}
+ See Note [Top-level Defaulting Plan] in GHC.Tc.Solver -}
diff --git a/testsuite/tests/typecheck/should_compile/Improvement.hs b/testsuite/tests/typecheck/should_compile/Improvement.hs
index b7bda66813..3e15139853 100644
--- a/testsuite/tests/typecheck/should_compile/Improvement.hs
+++ b/testsuite/tests/typecheck/should_compile/Improvement.hs
@@ -8,7 +8,7 @@
-- overkill.
--
-- See Note Note [No reduction for Derived class constraints]
--- in TcInteract
+-- in GHC.Tc.Solver.Interact
module Foo where
diff --git a/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs b/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs
index bc57d16089..2f0297cf2d 100644
--- a/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs
+++ b/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs
@@ -1,6 +1,6 @@
module T11462_Plugin(plugin) where
-import TcRnMonad ( TcPlugin(..), TcPluginResult(..) )
+import GHC.Tc.Utils.Monad ( TcPlugin(..), TcPluginResult(..) )
import GHC.Driver.Plugins ( defaultPlugin, Plugin(..), CommandLineOption )
plugin :: Plugin
diff --git a/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs b/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs
index 5133b87b7f..206c3c2a8f 100644
--- a/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs
+++ b/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs
@@ -1,6 +1,6 @@
module T11525_Plugin(plugin) where
-import TcRnMonad ( TcPlugin(..), TcPluginResult(..) )
+import GHC.Tc.Utils.Monad ( TcPlugin(..), TcPluginResult(..) )
import GHC.Driver.Plugins ( defaultPlugin, Plugin(..), CommandLineOption )
plugin :: Plugin
diff --git a/testsuite/tests/typecheck/should_compile/tc079.hs b/testsuite/tests/typecheck/should_compile/tc079.hs
index 6784df6024..0aa9015f52 100644
--- a/testsuite/tests/typecheck/should_compile/tc079.hs
+++ b/testsuite/tests/typecheck/should_compile/tc079.hs
@@ -2,7 +2,7 @@
-- !!! small class decl with local polymorphism;
-- !!! "easy" to check default methods and such...
--- !!! (this is the example given in TcClassDcl)
+-- !!! (this is the example given in GHC.Tc.TyCl.Class)
--
module ShouldSucceed where
diff --git a/testsuite/tests/typecheck/should_compile/tc101.hs b/testsuite/tests/typecheck/should_compile/tc101.hs
index 7ae95d53f5..d2c7958fac 100644
--- a/testsuite/tests/typecheck/should_compile/tc101.hs
+++ b/testsuite/tests/typecheck/should_compile/tc101.hs
@@ -4,7 +4,7 @@
module ShouldCompile where
-- This made the compiler (4.04 proto) loop (stack overflow)
--- The bug was in TcUnify.uUnboundVar and is documented there.
+-- The bug was in GHC.Tc.Utils.Unify.uUnboundVar and is documented there.
type A a = ()
diff --git a/testsuite/tests/typecheck/should_compile/tc129.hs b/testsuite/tests/typecheck/should_compile/tc129.hs
index 56163ffe31..abbd1f259c 100644
--- a/testsuite/tests/typecheck/should_compile/tc129.hs
+++ b/testsuite/tests/typecheck/should_compile/tc129.hs
@@ -4,7 +4,7 @@
-- GHC 5.00.2 fails this test
-- The thing is to do with whether an implicit parameter
--- constraint can be "inherited". See notes in TcSimplify.lhs
+-- constraint can be "inherited". See notes in GHC.Tc.Solver
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_compile/tc157.hs b/testsuite/tests/typecheck/should_compile/tc157.hs
index 4baebab5fc..57c1b99ae8 100644
--- a/testsuite/tests/typecheck/should_compile/tc157.hs
+++ b/testsuite/tests/typecheck/should_compile/tc157.hs
@@ -16,4 +16,4 @@ bar = foo (\t -> t + t)
-- the arg to foo. But it might because it's Num (C u a)!
-- This test tickles a bizarre corner case documented
--- as [Silly Type Synonym] in TcMType.lhs
+-- as [Silly Type Synonym] in GHC.Tc.Utils.TcMType
diff --git a/testsuite/tests/typecheck/should_compile/tc161.hs b/testsuite/tests/typecheck/should_compile/tc161.hs
index a247e2b1be..342cc6d5d4 100644
--- a/testsuite/tests/typecheck/should_compile/tc161.hs
+++ b/testsuite/tests/typecheck/should_compile/tc161.hs
@@ -7,7 +7,7 @@
-- In the application `GHC.Err.noMethodBindingError "Foo.hs:7|Foo.foo"#'
--
-- Fix is to give wild-card args to the default methods
--- See TcClassDcl.mkDefMethRhs
+-- See GHC.Tc.TyCl.Class.mkDefMethRhs
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_compile/tc176.hs b/testsuite/tests/typecheck/should_compile/tc176.hs
index d41cbb564e..ebfe7a405a 100644
--- a/testsuite/tests/typecheck/should_compile/tc176.hs
+++ b/testsuite/tests/typecheck/should_compile/tc176.hs
@@ -20,7 +20,7 @@
-- Sept 08: on further reflection (!) I'm changing it back
-- See Note [Subtle interaction of recursion and overlap]
--- in TcInstDcls
+-- in GHC.Tc.TyCl.Instance
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_compile/tc178.hs b/testsuite/tests/typecheck/should_compile/tc178.hs
index d8904c12db..c676a2f7eb 100644
--- a/testsuite/tests/typecheck/should_compile/tc178.hs
+++ b/testsuite/tests/typecheck/should_compile/tc178.hs
@@ -1,7 +1,7 @@
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE FlexibleInstances #-}
--- This one tickled the kind-check in TcType.matchTys,
+-- This one tickled the kind-check in GHC.Tc.Utils.TcType.matchTys,
-- which should use sub-kinding
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_compile/tc200.hs b/testsuite/tests/typecheck/should_compile/tc200.hs
index ef799c61d1..43eb0947c0 100644
--- a/testsuite/tests/typecheck/should_compile/tc200.hs
+++ b/testsuite/tests/typecheck/should_compile/tc200.hs
@@ -2,7 +2,7 @@
{-# LANGUAGE ConstrainedClassMethods #-} -- Needed for 'baz'
-- A nasty case that crashed GHC 6.4 with a Lint error;
--- see Note [Multiple instantiation] in TcExpr
+-- see Note [Multiple instantiation] in GHC.Tc.Gen.Expr
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_compile/tc228.hs b/testsuite/tests/typecheck/should_compile/tc228.hs
index 7989674847..67703a2a91 100644
--- a/testsuite/tests/typecheck/should_compile/tc228.hs
+++ b/testsuite/tests/typecheck/should_compile/tc228.hs
@@ -6,7 +6,7 @@
-- Reason: we get an implication constraint (forall a. Typeable a => Typeable b),
-- when generalising unExTypeable. We want to infer a context for the
-- whole thing of (Typeable b).
--- See Note [Inference and implication constraints] in TcSimplify
+-- See Note [Inference and implication constraints] in GHC.Tc.Solver
module Foo where
diff --git a/testsuite/tests/typecheck/should_compile/tc231.hs b/testsuite/tests/typecheck/should_compile/tc231.hs
index 9d0fc8316b..a00f17cf83 100644
--- a/testsuite/tests/typecheck/should_compile/tc231.hs
+++ b/testsuite/tests/typecheck/should_compile/tc231.hs
@@ -8,7 +8,7 @@
-- => Q s (Z [Char]) t1 -> ST s ()
-- Note the quantification over 'b', which was previously
--- omitted; see Note [Important subtlety in oclose] in FunDeps
+-- omitted; see Note [Important subtlety in oclose] in GHC.Tc.Instance.FunDeps
module ShouldCompile where
diff --git a/testsuite/tests/typecheck/should_fail/T16512b.hs b/testsuite/tests/typecheck/should_fail/T16512b.hs
index ad2a824224..68820c252b 100644
--- a/testsuite/tests/typecheck/should_fail/T16512b.hs
+++ b/testsuite/tests/typecheck/should_fail/T16512b.hs
@@ -6,4 +6,4 @@ type family G a = r | r -> a where
G [a] = [G a]
-- this needs -XUndecidableInstances.
--- See Note [Coverage condition for injective type families] in FamInst
+-- See Note [Coverage condition for injective type families] in GHC.Tc.Instance.Family
diff --git a/testsuite/tests/typecheck/should_fail/tcfail093.hs b/testsuite/tests/typecheck/should_fail/tcfail093.hs
index 6e2e6781ba..2329bfa2ff 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail093.hs
+++ b/testsuite/tests/typecheck/should_fail/tcfail093.hs
@@ -10,7 +10,7 @@ module ShouldFail where
-- Reported by Thomas Hallgren Nov 00
-- July 07: I'm changing this from "should fail" to "should succeed"
--- See Note [Important subtlety in oclose] in FunDeps
+-- See Note [Important subtlety in oclose] in GHC.Tc.Instance.FunDeps
primDup :: Int -> IO Int
diff --git a/testsuite/tests/typecheck/should_fail/tcfail098.hs b/testsuite/tests/typecheck/should_fail/tcfail098.hs
index 6c06b898e0..159e9c8081 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail098.hs
+++ b/testsuite/tests/typecheck/should_fail/tcfail098.hs
@@ -6,7 +6,7 @@ module ShouldFail where
-- is ambiguous, but we have UndecidableInstances on, so
-- it could conceivably be ok (we'd need OverlappingInstances
-- too in this case). So we allow it.
--- See Note [The ambiguity check for type signatures] in TcMType
+-- See Note [The ambiguity check for type signatures] in GHC.Tc.Utils.TcMType
class Bar a
instance Bar a => Bar Bool
diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.hs b/testsuite/tests/typecheck/should_fail/tcfail133.hs
index af45be93cd..da58021700 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.hs
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE UndecidableInstances, FlexibleInstances, TypeOperators,
MultiParamTypeClasses, FunctionalDependencies, DatatypeContexts #-}
--- This one crashed GHC 6.3 due to an error in TcSimplify.add_ors
+-- This one crashed GHC 6.3 due to an error in GHC.Tc.Solver.add_ors
module Foo where
diff --git a/testsuite/tests/typecheck/should_fail/tcfail142.hs b/testsuite/tests/typecheck/should_fail/tcfail142.hs
index add92e43ab..a628b0e335 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail142.hs
+++ b/testsuite/tests/typecheck/should_fail/tcfail142.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE MultiParamTypeClasses #-}
-- Tests top-level ambiguity resolution
--- This made a post-6.4 GHC fall over in TcSimplify
+-- This made a post-6.4 GHC fall over in GHC.Tc.Solver
module ShouldFail where
diff --git a/testsuite/tests/typecheck/should_run/tcrun021.hs b/testsuite/tests/typecheck/should_run/tcrun021.hs
index b9bda74c0c..4a80ed1bb0 100644
--- a/testsuite/tests/typecheck/should_run/tcrun021.hs
+++ b/testsuite/tests/typecheck/should_run/tcrun021.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
TypeSynonymInstances, FlexibleInstances #-}
--- This bizarre program failed because TcSimplify built a loop of
+-- This bizarre program failed because GHC.Tc.Solver built a loop of
-- dictionaries, due to an obscure bug in the way in which superclasses
-- were added
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs
index 7418045e22..bcbfe968c8 100644
--- a/utils/genprimopcode/Main.hs
+++ b/utils/genprimopcode/Main.hs
@@ -392,7 +392,7 @@ needs. Our main plan is to say
foo :: <type>
foo = foo
We have to silence GHC's complaints about unboxed-top-level declarations
-with an ad-hoc fix in TcBinds: see Note [Compiling GHC.Prim] in TcBinds.
+with an ad-hoc fix in GHC.Tc.Gen.Bind: see Note [Compiling GHC.Prim] in GHC.Tc.Gen.Bind.
That works for all the primitive functions except tagToEnum#.
If we generate the binding
diff --git a/utils/haddock b/utils/haddock
-Subproject 65f22afa9e66195baa6b7d44369e2b23cd8f77d
+Subproject 38036137bce2587c6d50756f6fab8cfafeb5a63