diff options
323 files changed, 743 insertions, 331 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs index 834748a2b0..a3795eda79 100644 --- a/compiler/GHC.hs +++ b/compiler/GHC.hs @@ -338,6 +338,7 @@ import GHC.Driver.Types import GHC.Driver.CmdLine import GHC.Driver.Session hiding (WarnReason(..)) import GHC.Platform.Ways +import GHC.Driver.Ppr import GHC.SysTools import GHC.SysTools.BaseDir import GHC.Types.Annotations diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index ce506000ac..44a61dc2cb 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -181,9 +181,11 @@ import GHC.Types.SrcLoc ( noSrcSpan ) import GHC.Types.Unique import Data.Array import GHC.Data.FastString +import GHC.Data.BooleanFormula ( mkAnd ) + import GHC.Utils.Outputable import GHC.Utils.Misc -import GHC.Data.BooleanFormula ( mkAnd ) +import GHC.Utils.Panic import qualified Data.ByteString.Char8 as BS diff --git a/compiler/GHC/Builtin/Types/Prim.hs b/compiler/GHC/Builtin/Types/Prim.hs index 511af6f217..20c0ab634d 100644 --- a/compiler/GHC/Builtin/Types/Prim.hs +++ b/compiler/GHC/Builtin/Types/Prim.hs @@ -121,6 +121,7 @@ import GHC.Types.Unique import GHC.Builtin.Names import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.TyCo.Rep -- Doesn't need special access, but this is easier to avoid -- import loops which show up if you import Type instead diff --git a/compiler/GHC/Builtin/Uniques.hs b/compiler/GHC/Builtin/Uniques.hs index 5c0e29b7de..326467566f 100644 --- a/compiler/GHC/Builtin/Uniques.hs +++ b/compiler/GHC/Builtin/Uniques.hs @@ -33,10 +33,12 @@ import GHC.Core.TyCon import GHC.Core.DataCon import GHC.Types.Id import GHC.Types.Basic -import GHC.Utils.Outputable import GHC.Types.Unique import GHC.Types.Name + +import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Bits import Data.Maybe diff --git a/compiler/GHC/Builtin/Utils.hs b/compiler/GHC/Builtin/Utils.hs index 9874edc9b7..208b630e2e 100644 --- a/compiler/GHC/Builtin/Utils.hs +++ b/compiler/GHC/Builtin/Utils.hs @@ -72,6 +72,7 @@ import GHC.Core.Class import GHC.Core.TyCon import GHC.Types.Unique.FM import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Builtin.Types.Literals ( typeNatTyCons ) import GHC.Hs.Doc diff --git a/compiler/GHC/ByteCode/Asm.hs b/compiler/GHC/ByteCode/Asm.hs index 48b6dc980d..e27af3ad1b 100644 --- a/compiler/GHC/ByteCode/Asm.hs +++ b/compiler/GHC/ByteCode/Asm.hs @@ -33,6 +33,7 @@ import GHC.StgToCmm.Layout ( ArgRep(..) ) import GHC.Runtime.Heap.Layout import GHC.Driver.Session import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Utils.Misc import GHC.Types.Unique diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs index 602e3d38fc..5f2eb565c5 100644 --- a/compiler/GHC/Cmm/CLabel.hs +++ b/compiler/GHC/Cmm/CLabel.hs @@ -127,6 +127,7 @@ import GHC.Types.Unique import GHC.Builtin.PrimOps import GHC.Types.CostCentre import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Driver.Session import GHC.Driver.Backend diff --git a/compiler/GHC/Cmm/CallConv.hs b/compiler/GHC/Cmm/CallConv.hs index 09d1d26924..5d591a0dd3 100644 --- a/compiler/GHC/Cmm/CallConv.hs +++ b/compiler/GHC/Cmm/CallConv.hs @@ -16,6 +16,7 @@ import GHC.Driver.Session import GHC.Platform import GHC.Platform.Profile import GHC.Utils.Outputable +import GHC.Utils.Panic -- Calculate the 'GlobalReg' or stack locations for function call -- parameters as used by the Cmm calling convention. diff --git a/compiler/GHC/Cmm/CommonBlockElim.hs b/compiler/GHC/Cmm/CommonBlockElim.hs index cc6cb2d40b..d88745ad21 100644 --- a/compiler/GHC/Cmm/CommonBlockElim.hs +++ b/compiler/GHC/Cmm/CommonBlockElim.hs @@ -24,6 +24,7 @@ import qualified Data.List as List import Data.Word import qualified Data.Map as M import GHC.Utils.Outputable +import GHC.Utils.Panic import qualified GHC.Data.TrieMap as TM import GHC.Types.Unique.FM import GHC.Types.Unique diff --git a/compiler/GHC/Cmm/DebugBlock.hs b/compiler/GHC/Cmm/DebugBlock.hs index fbd64b55b0..4e39fb7ecd 100644 --- a/compiler/GHC/Cmm/DebugBlock.hs +++ b/compiler/GHC/Cmm/DebugBlock.hs @@ -36,6 +36,7 @@ import GHC.Core import GHC.Data.FastString ( nilFS, mkFastString ) import GHC.Unit.Module import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Cmm.Ppr.Expr ( pprExpr ) import GHC.Types.SrcLoc import GHC.Utils.Misc ( seqList ) diff --git a/compiler/GHC/Cmm/Expr.hs b/compiler/GHC/Cmm/Expr.hs index 43d6734633..9b6f160a53 100644 --- a/compiler/GHC/Cmm/Expr.hs +++ b/compiler/GHC/Cmm/Expr.hs @@ -39,7 +39,7 @@ import GHC.Cmm.CLabel import GHC.Cmm.MachOp import GHC.Cmm.Type import GHC.Driver.Session -import GHC.Utils.Outputable (panic) +import GHC.Utils.Panic (panic) import GHC.Types.Unique import Data.Set (Set) diff --git a/compiler/GHC/Cmm/Info/Build.hs b/compiler/GHC/Cmm/Info/Build.hs index 8e91c2636e..84c7999f69 100644 --- a/compiler/GHC/Cmm/Info/Build.hs +++ b/compiler/GHC/Cmm/Info/Build.hs @@ -29,6 +29,7 @@ import GHC.Cmm.Utils import GHC.Driver.Session import GHC.Data.Maybe import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Runtime.Heap.Layout import GHC.Types.Unique.Supply import GHC.Types.CostCentre diff --git a/compiler/GHC/Cmm/LayoutStack.hs b/compiler/GHC/Cmm/LayoutStack.hs index f1137cf4fe..9cf4638001 100644 --- a/compiler/GHC/Cmm/LayoutStack.hs +++ b/compiler/GHC/Cmm/LayoutStack.hs @@ -35,6 +35,7 @@ import GHC.Utils.Misc import GHC.Driver.Session import GHC.Data.FastString import GHC.Utils.Outputable hiding ( isEmpty ) +import GHC.Utils.Panic import qualified Data.Set as Set import Control.Monad.Fix import Data.Array as Array diff --git a/compiler/GHC/Cmm/Liveness.hs b/compiler/GHC/Cmm/Liveness.hs index c229e48529..c8b7993736 100644 --- a/compiler/GHC/Cmm/Liveness.hs +++ b/compiler/GHC/Cmm/Liveness.hs @@ -25,6 +25,7 @@ import GHC.Cmm.Dataflow.Label import GHC.Data.Maybe import GHC.Utils.Outputable +import GHC.Utils.Panic ----------------------------------------------------------------------------- -- Calculating what variables are live on entry to a basic block diff --git a/compiler/GHC/Cmm/Opt.hs b/compiler/GHC/Cmm/Opt.hs index 493122024c..fc75e1901e 100644 --- a/compiler/GHC/Cmm/Opt.hs +++ b/compiler/GHC/Cmm/Opt.hs @@ -19,7 +19,7 @@ import GHC.Cmm.Utils import GHC.Cmm import GHC.Utils.Misc -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.Bits diff --git a/compiler/GHC/Cmm/Parser.y b/compiler/GHC/Cmm/Parser.y index f03383833c..0be73b66f8 100644 --- a/compiler/GHC/Cmm/Parser.y +++ b/compiler/GHC/Cmm/Parser.y @@ -247,6 +247,7 @@ import GHC.Types.Unique import GHC.Types.Unique.FM import GHC.Types.SrcLoc import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Error import GHC.Data.StringBuffer import GHC.Data.FastString @@ -1047,7 +1048,7 @@ callishMachOps = listToUFM $ args' = init args align = case last args of CmmLit (CmmInt alignInteger _) -> fromInteger alignInteger - e -> pprPgmError "Non-constant alignment in memcpy-like function:" (ppr e) + e -> pgmErrorDoc "Non-constant alignment in memcpy-like function:" (ppr e) -- The alignment of memcpy-ish operations must be a -- compile-time constant. We verify this here, passing it around -- in the MO_* constructor. In order to do this, however, we diff --git a/compiler/GHC/Cmm/Ppr/Decl.hs b/compiler/GHC/Cmm/Ppr/Decl.hs index 43a341bf85..94216a537b 100644 --- a/compiler/GHC/Cmm/Ppr/Decl.hs +++ b/compiler/GHC/Cmm/Ppr/Decl.hs @@ -46,6 +46,7 @@ import GHC.Platform import GHC.Cmm.Ppr.Expr import GHC.Cmm +import GHC.Driver.Ppr import GHC.Driver.Session import GHC.Utils.Outputable import GHC.Data.FastString diff --git a/compiler/GHC/Cmm/Ppr/Expr.hs b/compiler/GHC/Cmm/Ppr/Expr.hs index 5bed66d537..4bb8021541 100644 --- a/compiler/GHC/Cmm/Ppr/Expr.hs +++ b/compiler/GHC/Cmm/Ppr/Expr.hs @@ -41,8 +41,10 @@ where import GHC.Prelude -import GHC.Platform import GHC.Driver.Session (targetPlatform) +import GHC.Driver.Ppr + +import GHC.Platform import GHC.Cmm.Expr import GHC.Utils.Outputable diff --git a/compiler/GHC/Cmm/ProcPoint.hs b/compiler/GHC/Cmm/ProcPoint.hs index cca69310b7..2de355deb3 100644 --- a/compiler/GHC/Cmm/ProcPoint.hs +++ b/compiler/GHC/Cmm/ProcPoint.hs @@ -24,6 +24,7 @@ import Data.List (sortBy) import GHC.Data.Maybe import Control.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique.Supply import GHC.Cmm.Dataflow.Block diff --git a/compiler/GHC/Cmm/Switch.hs b/compiler/GHC/Cmm/Switch.hs index ee0d5a07df..7bef1e293a 100644 --- a/compiler/GHC/Cmm/Switch.hs +++ b/compiler/GHC/Cmm/Switch.hs @@ -16,6 +16,7 @@ import GHC.Prelude import GHC.Utils.Outputable import GHC.Driver.Backend +import GHC.Utils.Panic import GHC.Cmm.Dataflow.Label (Label) import Data.Maybe diff --git a/compiler/GHC/Cmm/Type.hs b/compiler/GHC/Cmm/Type.hs index 0e7601cf3a..8a750cd10d 100644 --- a/compiler/GHC/Cmm/Type.hs +++ b/compiler/GHC/Cmm/Type.hs @@ -34,6 +34,7 @@ import GHC.Prelude import GHC.Platform import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.Word import Data.Int diff --git a/compiler/GHC/Cmm/Utils.hs b/compiler/GHC/Cmm/Utils.hs index d762f0d9b0..356fb4e138 100644 --- a/compiler/GHC/Cmm/Utils.hs +++ b/compiler/GHC/Cmm/Utils.hs @@ -79,6 +79,7 @@ import GHC.Cmm import GHC.Cmm.BlockId import GHC.Cmm.CLabel import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Platform.Regs diff --git a/compiler/GHC/CmmToAsm.hs b/compiler/GHC/CmmToAsm.hs index b27db24a7b..b37f8e9549 100644 --- a/compiler/GHC/CmmToAsm.hs +++ b/compiler/GHC/CmmToAsm.hs @@ -87,12 +87,14 @@ import GHC.Cmm.CLabel import GHC.Types.Unique.FM import GHC.Types.Unique.Supply import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Misc import GHC.Types.Basic ( Alignment ) import qualified GHC.Utils.Ppr as Pretty import GHC.Utils.BufHandle import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.Unique.Set import GHC.Utils.Error diff --git a/compiler/GHC/CmmToAsm/BlockLayout.hs b/compiler/GHC/CmmToAsm/BlockLayout.hs index 57d265782b..d93b84887e 100644 --- a/compiler/GHC/CmmToAsm/BlockLayout.hs +++ b/compiler/GHC/CmmToAsm/BlockLayout.hs @@ -16,6 +16,9 @@ where #include "HsVersions.h" import GHC.Prelude +import GHC.Driver.Session (gopt, GeneralFlag(..), DynFlags, targetPlatform) +import GHC.Driver.Ppr (pprTrace) + import GHC.CmmToAsm.Instr import GHC.CmmToAsm.Monad import GHC.CmmToAsm.CFG @@ -26,12 +29,12 @@ import GHC.Cmm.Dataflow.Collections import GHC.Cmm.Dataflow.Label import GHC.Platform -import GHC.Driver.Session (gopt, GeneralFlag(..), DynFlags, targetPlatform) import GHC.Types.Unique.FM import GHC.Utils.Misc import GHC.Data.Graph.Directed import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Maybe -- DEBUGGING ONLY diff --git a/compiler/GHC/CmmToAsm/CFG.hs b/compiler/GHC/CmmToAsm/CFG.hs index 5db10ce93f..dd46393649 100644 --- a/compiler/GHC/CmmToAsm/CFG.hs +++ b/compiler/GHC/CmmToAsm/CFG.hs @@ -73,6 +73,7 @@ import Data.Tree import Data.Bifunctor import GHC.Utils.Outputable +import GHC.Utils.Panic -- DEBUGGING ONLY --import GHC.Cmm.DebugBlock --import GHC.Data.OrdList diff --git a/compiler/GHC/CmmToAsm/CPrim.hs b/compiler/GHC/CmmToAsm/CPrim.hs index 826a6e2224..4de946686d 100644 --- a/compiler/GHC/CmmToAsm/CPrim.hs +++ b/compiler/GHC/CmmToAsm/CPrim.hs @@ -20,6 +20,7 @@ import GHC.Prelude import GHC.Cmm.Type import GHC.Cmm.MachOp import GHC.Utils.Outputable +import GHC.Utils.Panic popCntLabel :: Width -> String popCntLabel w = "hs_popcnt" ++ pprWidth w diff --git a/compiler/GHC/CmmToAsm/Dwarf.hs b/compiler/GHC/CmmToAsm/Dwarf.hs index c0da6977a9..ccf2cf8758 100644 --- a/compiler/GHC/CmmToAsm/Dwarf.hs +++ b/compiler/GHC/CmmToAsm/Dwarf.hs @@ -4,12 +4,14 @@ module GHC.CmmToAsm.Dwarf ( import GHC.Prelude +import GHC.Driver.Session +import GHC.Driver.Ppr + import GHC.Cmm.CLabel import GHC.Cmm.Expr ( GlobalReg(..) ) import GHC.Settings.Config ( cProjectName, cProjectVersion ) import GHC.Core ( Tickish(..) ) import GHC.Cmm.DebugBlock -import GHC.Driver.Session import GHC.Unit.Module import GHC.Utils.Outputable import GHC.Platform diff --git a/compiler/GHC/CmmToAsm/Format.hs b/compiler/GHC/CmmToAsm/Format.hs index 0049d2c987..207de095ae 100644 --- a/compiler/GHC/CmmToAsm/Format.hs +++ b/compiler/GHC/CmmToAsm/Format.hs @@ -24,6 +24,7 @@ import GHC.Prelude import GHC.Cmm import GHC.Utils.Outputable +import GHC.Utils.Panic -- It looks very like the old MachRep, but it's now of purely local -- significance, here in the native code generator. You can change it diff --git a/compiler/GHC/CmmToAsm/Monad.hs b/compiler/GHC/CmmToAsm/Monad.hs index 68bb46acd0..04921f7022 100644 --- a/compiler/GHC/CmmToAsm/Monad.hs +++ b/compiler/GHC/CmmToAsm/Monad.hs @@ -69,7 +69,8 @@ import GHC.Unit.Module import Control.Monad ( ap ) import GHC.CmmToAsm.Instr -import GHC.Utils.Outputable (SDoc, pprPanic, ppr) +import GHC.Utils.Outputable (SDoc, ppr) +import GHC.Utils.Panic (pprPanic) import GHC.Cmm (RawCmmDecl, RawCmmStatics) import GHC.CmmToAsm.CFG diff --git a/compiler/GHC/CmmToAsm/PIC.hs b/compiler/GHC/CmmToAsm/PIC.hs index 77ffcfd930..419f8eb9d8 100644 --- a/compiler/GHC/CmmToAsm/PIC.hs +++ b/compiler/GHC/CmmToAsm/PIC.hs @@ -68,6 +68,7 @@ import GHC.Types.Basic import GHC.Unit.Module import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString diff --git a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs index 367faa25bc..e704beb61f 100644 --- a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs @@ -62,6 +62,7 @@ import GHC.Types.SrcLoc ( srcSpanFile, srcSpanStartLine, srcSpanStartCol ) -- The rest: import GHC.Data.OrdList import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad ( mapAndUnzipM, when ) import Data.Bits diff --git a/compiler/GHC/CmmToAsm/PPC/Instr.hs b/compiler/GHC/CmmToAsm/PPC/Instr.hs index 26c50bcdc8..29655647fa 100644 --- a/compiler/GHC/CmmToAsm/PPC/Instr.hs +++ b/compiler/GHC/CmmToAsm/PPC/Instr.hs @@ -43,7 +43,7 @@ import GHC.Cmm import GHC.Cmm.Info import GHC.Data.FastString import GHC.Cmm.CLabel -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique.FM (listToUFM, lookupUFM) import GHC.Types.Unique.Supply diff --git a/compiler/GHC/CmmToAsm/PPC/Ppr.hs b/compiler/GHC/CmmToAsm/PPC/Ppr.hs index bb8d412f52..99cb22ba28 100644 --- a/compiler/GHC/CmmToAsm/PPC/Ppr.hs +++ b/compiler/GHC/CmmToAsm/PPC/Ppr.hs @@ -34,6 +34,7 @@ import GHC.Types.Unique ( pprUniqueAlways, getUnique ) import GHC.Platform import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Driver.Session (targetPlatform) import Data.Word diff --git a/compiler/GHC/CmmToAsm/PPC/Regs.hs b/compiler/GHC/CmmToAsm/PPC/Regs.hs index a92c7f00ef..3068be7ac5 100644 --- a/compiler/GHC/CmmToAsm/PPC/Regs.hs +++ b/compiler/GHC/CmmToAsm/PPC/Regs.hs @@ -62,6 +62,7 @@ import GHC.Types.Unique import GHC.Platform.Regs import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.Word ( Word8, Word16, Word32, Word64 ) diff --git a/compiler/GHC/CmmToAsm/Ppr.hs b/compiler/GHC/CmmToAsm/Ppr.hs index 405bab9fff..cec114e499 100644 --- a/compiler/GHC/CmmToAsm/Ppr.hs +++ b/compiler/GHC/CmmToAsm/Ppr.hs @@ -29,6 +29,7 @@ import GHC.Cmm import GHC.CmmToAsm.Config import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import qualified Data.Array.Unsafe as U ( castSTUArray ) diff --git a/compiler/GHC/CmmToAsm/Reg/Graph.hs b/compiler/GHC/CmmToAsm/Reg/Graph.hs index fad2750ef4..c544d9ff8a 100644 --- a/compiler/GHC/CmmToAsm/Reg/Graph.hs +++ b/compiler/GHC/CmmToAsm/Reg/Graph.hs @@ -22,6 +22,7 @@ import GHC.Platform.Reg import GHC.Data.Bag import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique.FM import GHC.Types.Unique.Set diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs b/compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs index 6226c1c269..b3c06cefcc 100644 --- a/compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs +++ b/compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs @@ -24,6 +24,7 @@ import GHC.Types.Unique.FM import GHC.Types.Unique.Set import GHC.Types.Unique.Supply import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.List diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs b/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs index fec35cb6bc..af0e8d970f 100644 --- a/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs +++ b/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs @@ -46,6 +46,7 @@ import GHC.Types.Unique.FM import GHC.Types.Unique import GHC.Utils.Monad.State import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Cmm.Dataflow.Collections diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs b/compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs index 1ea380fabf..a5d09d5eea 100644 --- a/compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs +++ b/compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs @@ -29,6 +29,7 @@ import GHC.Types.Unique.FM import GHC.Types.Unique.Set import GHC.Data.Graph.Directed (flattenSCCs) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Utils.Monad.State import GHC.CmmToAsm.CFG diff --git a/compiler/GHC/CmmToAsm/Reg/Linear.hs b/compiler/GHC/CmmToAsm/Reg/Linear.hs index f777a21ca6..4d666bc557 100644 --- a/compiler/GHC/CmmToAsm/Reg/Linear.hs +++ b/compiler/GHC/CmmToAsm/Reg/Linear.hs @@ -134,6 +134,7 @@ import GHC.Types.Unique.Set import GHC.Types.Unique.FM import GHC.Types.Unique.Supply import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.Maybe diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs b/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs index 8d3a46f490..de489b342b 100644 --- a/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs +++ b/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs @@ -24,6 +24,7 @@ import GHC.Cmm.BlockId import GHC.Cmm.Dataflow.Collections import GHC.Data.Graph.Directed import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Types.Unique.FM import GHC.Types.Unique.Set diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs b/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs index fd0719c656..0cc155aa07 100644 --- a/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs +++ b/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs @@ -10,6 +10,7 @@ import GHC.Platform.Reg.Class import GHC.Platform.Reg import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.Word diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/SPARC.hs b/compiler/GHC/CmmToAsm/Reg/Linear/SPARC.hs index 063a8836b3..0bb4448d6e 100644 --- a/compiler/GHC/CmmToAsm/Reg/Linear/SPARC.hs +++ b/compiler/GHC/CmmToAsm/Reg/Linear/SPARC.hs @@ -12,6 +12,7 @@ import GHC.Platform.Reg import GHC.Platform.Regs import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Data.Word diff --git a/compiler/GHC/CmmToAsm/Reg/Liveness.hs b/compiler/GHC/CmmToAsm/Reg/Liveness.hs index 13dbcc5f70..00adf1cc34 100644 --- a/compiler/GHC/CmmToAsm/Reg/Liveness.hs +++ b/compiler/GHC/CmmToAsm/Reg/Liveness.hs @@ -52,6 +52,7 @@ import GHC.Cmm hiding (RegSet, emptyRegSet) import GHC.Data.Graph.Directed import GHC.Utils.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique.Set import GHC.Types.Unique.FM diff --git a/compiler/GHC/CmmToAsm/Reg/Target.hs b/compiler/GHC/CmmToAsm/Reg/Target.hs index d4bc561faa..c925816e24 100644 --- a/compiler/GHC/CmmToAsm/Reg/Target.hs +++ b/compiler/GHC/CmmToAsm/Reg/Target.hs @@ -28,6 +28,7 @@ import GHC.Platform.Reg.Class import GHC.CmmToAsm.Format import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Platform diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs index 9ecb0fcc76..fcebf9c487 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs @@ -55,7 +55,7 @@ import GHC.CmmToAsm.CPrim import GHC.Types.Basic import GHC.Data.FastString import GHC.Data.OrdList -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import Control.Monad ( mapAndUnzipM ) diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Base.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Base.hs index 0662fd06af..dc132211bc 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Base.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Base.hs @@ -28,6 +28,7 @@ import GHC.Cmm.Ppr.Expr () -- For Outputable instances import GHC.Platform import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.OrdList -------------------------------------------------------------------------------- diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/CondCode.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/CondCode.hs index 0a6de1a034..42d71a022c 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/CondCode.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/CondCode.hs @@ -22,6 +22,7 @@ import GHC.Cmm import GHC.Data.OrdList import GHC.Utils.Outputable +import GHC.Utils.Panic getCondCode :: CmmExpr -> NatM CondCode diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Expand.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Expand.hs index 495a973c90..c1660f989b 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Expand.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Expand.hs @@ -18,8 +18,8 @@ import GHC.Platform.Reg import GHC.CmmToAsm.Format import GHC.Cmm - import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.OrdList -- | Expand out synthetic instructions in this top level thing diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen32.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen32.hs index e5b5990150..f07cbec9a8 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen32.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen32.hs @@ -27,7 +27,7 @@ import GHC.Cmm import Control.Monad (liftM) import GHC.Data.OrdList -import GHC.Utils.Outputable +import GHC.Utils.Panic -- | The dual to getAnyReg: compute an expression into a register, but -- we don't mind which one it is. diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen64.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen64.hs index 00a94ceb24..52d4f125b5 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen64.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Gen64.hs @@ -26,6 +26,7 @@ import GHC.Cmm import GHC.Data.OrdList import GHC.Utils.Outputable +import GHC.Utils.Panic -- | Code to assign a 64 bit value to memory. assignMem_I64Code diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Sanity.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Sanity.hs index f6ec24434c..a1060e5cf2 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen/Sanity.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen/Sanity.hs @@ -15,6 +15,7 @@ import GHC.CmmToAsm.Instr import GHC.Cmm import GHC.Utils.Outputable +import GHC.Utils.Panic -- | Enforce intra-block invariants. diff --git a/compiler/GHC/CmmToAsm/SPARC/Imm.hs b/compiler/GHC/CmmToAsm/SPARC/Imm.hs index fd4185565c..35ff7a31cd 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Imm.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Imm.hs @@ -13,6 +13,7 @@ import GHC.Cmm import GHC.Cmm.CLabel import GHC.Utils.Outputable +import GHC.Utils.Panic -- | An immediate value. -- Not all of these are directly representable by the machine. diff --git a/compiler/GHC/CmmToAsm/SPARC/Instr.hs b/compiler/GHC/CmmToAsm/SPARC/Instr.hs index 6da02818db..7f0db3c18d 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Instr.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Instr.hs @@ -44,7 +44,7 @@ import GHC.Platform.Regs import GHC.Cmm.BlockId import GHC.Cmm import GHC.Data.FastString -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform diff --git a/compiler/GHC/CmmToAsm/SPARC/Ppr.hs b/compiler/GHC/CmmToAsm/SPARC/Ppr.hs index d1e7dbfa38..98f6096ac1 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Ppr.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Ppr.hs @@ -47,6 +47,7 @@ import GHC.Cmm.Dataflow.Collections import GHC.Types.Unique ( pprUniqueAlways ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Data.FastString diff --git a/compiler/GHC/CmmToAsm/SPARC/Regs.hs b/compiler/GHC/CmmToAsm/SPARC/Regs.hs index fe2de7f544..949701cf2d 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Regs.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Regs.hs @@ -41,6 +41,7 @@ import GHC.CmmToAsm.Format import GHC.Types.Unique import GHC.Utils.Outputable +import GHC.Utils.Panic {- The SPARC has 64 registers of interest; 32 integer registers and 32 diff --git a/compiler/GHC/CmmToAsm/SPARC/Stack.hs b/compiler/GHC/CmmToAsm/SPARC/Stack.hs index 4333f767f7..be51164da1 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Stack.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Stack.hs @@ -16,6 +16,7 @@ import GHC.CmmToAsm.SPARC.Imm import GHC.CmmToAsm.Config import GHC.Utils.Outputable +import GHC.Utils.Panic -- | Get an AddrMode relative to the address in sp. -- This gives us a stack relative addressing mode for volatile diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs index f210cebb2d..85343f0666 100644 --- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs @@ -83,6 +83,7 @@ import GHC.Types.SrcLoc ( srcSpanFile, srcSpanStartLine, srcSpanStartCol ) import GHC.Types.ForeignCall ( CCallConv(..) ) import GHC.Data.OrdList import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Driver.Session import GHC.Utils.Misc diff --git a/compiler/GHC/CmmToAsm/X86/Instr.hs b/compiler/GHC/CmmToAsm/X86/Instr.hs index eafe7198e6..ae9d45462e 100644 --- a/compiler/GHC/CmmToAsm/X86/Instr.hs +++ b/compiler/GHC/CmmToAsm/X86/Instr.hs @@ -36,6 +36,7 @@ import GHC.Platform.Regs import GHC.Cmm import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Basic (Alignment) diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs index 49e4de8ad5..a733290733 100644 --- a/compiler/GHC/CmmToAsm/X86/Ppr.hs +++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs @@ -45,6 +45,7 @@ import GHC.Types.Unique ( pprUniqueAlways ) import GHC.Platform import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.Word import Data.Bits diff --git a/compiler/GHC/CmmToAsm/X86/RegInfo.hs b/compiler/GHC/CmmToAsm/X86/RegInfo.hs index 3f7d50d319..0b5071ab97 100644 --- a/compiler/GHC/CmmToAsm/X86/RegInfo.hs +++ b/compiler/GHC/CmmToAsm/X86/RegInfo.hs @@ -14,6 +14,7 @@ import GHC.CmmToAsm.Format import GHC.Platform.Reg import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique diff --git a/compiler/GHC/CmmToAsm/X86/Regs.hs b/compiler/GHC/CmmToAsm/X86/Regs.hs index 8e6f215d3c..a815ad0450 100644 --- a/compiler/GHC/CmmToAsm/X86/Regs.hs +++ b/compiler/GHC/CmmToAsm/X86/Regs.hs @@ -58,6 +58,7 @@ import GHC.Platform.Reg.Class import GHC.Cmm import GHC.Cmm.CLabel ( CLabel ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import qualified Data.Array as A diff --git a/compiler/GHC/CmmToC.hs b/compiler/GHC/CmmToC.hs index 54b50577c8..daf98f71a5 100644 --- a/compiler/GHC/CmmToC.hs +++ b/compiler/GHC/CmmToC.hs @@ -43,8 +43,10 @@ import GHC.Cmm.Switch -- Utils import GHC.CmmToAsm.CPrim import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.Unique.Set import GHC.Types.Unique.FM diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs index 13a557dcd9..22c2eb01df 100644 --- a/compiler/GHC/CmmToLlvm.hs +++ b/compiler/GHC/CmmToLlvm.hs @@ -34,6 +34,7 @@ import GHC.Platform ( platformArch, Arch(..) ) import GHC.Utils.Error import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.SysTools ( figureLlvmVersion ) import qualified GHC.Data.Stream as Stream diff --git a/compiler/GHC/CmmToLlvm/CodeGen.hs b/compiler/GHC/CmmToLlvm/CodeGen.hs index 5581928a55..916931eefa 100644 --- a/compiler/GHC/CmmToLlvm/CodeGen.hs +++ b/compiler/GHC/CmmToLlvm/CodeGen.hs @@ -10,6 +10,9 @@ module GHC.CmmToLlvm.CodeGen ( genLlvmProc ) where import GHC.Prelude +import GHC.Driver.Session +import GHC.Driver.Ppr + import GHC.Llvm import GHC.CmmToLlvm.Base import GHC.CmmToLlvm.Regs @@ -25,11 +28,11 @@ import GHC.Cmm.Dataflow.Block import GHC.Cmm.Dataflow.Graph import GHC.Cmm.Dataflow.Collections -import GHC.Driver.Session import GHC.Data.FastString import GHC.Types.ForeignCall -import GHC.Utils.Outputable hiding (panic, pprPanic) -import qualified GHC.Utils.Outputable as Outputable +import GHC.Utils.Outputable +import GHC.Utils.Panic (assertPanic) +import qualified GHC.Utils.Panic as Panic import GHC.Platform import GHC.Data.OrdList import GHC.Types.Unique.Supply @@ -2001,10 +2004,10 @@ toIWord platform = mkIntLit (llvmWord platform) -- | Error functions panic :: HasCallStack => String -> a -panic s = Outputable.panic $ "GHC.CmmToLlvm.CodeGen." ++ s +panic s = Panic.panic $ "GHC.CmmToLlvm.CodeGen." ++ s pprPanic :: HasCallStack => String -> SDoc -> a -pprPanic s d = Outputable.pprPanic ("GHC.CmmToLlvm.CodeGen." ++ s) d +pprPanic s d = Panic.pprPanic ("GHC.CmmToLlvm.CodeGen." ++ s) d -- | Returns TBAA meta data by unique diff --git a/compiler/GHC/CmmToLlvm/Data.hs b/compiler/GHC/CmmToLlvm/Data.hs index ac155179d1..79e2e1a28b 100644 --- a/compiler/GHC/CmmToLlvm/Data.hs +++ b/compiler/GHC/CmmToLlvm/Data.hs @@ -20,7 +20,7 @@ import GHC.Cmm import GHC.Platform import GHC.Data.FastString -import GHC.Utils.Outputable +import GHC.Utils.Panic import qualified Data.ByteString as BS -- ---------------------------------------------------------------------------- diff --git a/compiler/GHC/CmmToLlvm/Ppr.hs b/compiler/GHC/CmmToLlvm/Ppr.hs index 49374a9869..6519eee637 100644 --- a/compiler/GHC/CmmToLlvm/Ppr.hs +++ b/compiler/GHC/CmmToLlvm/Ppr.hs @@ -11,6 +11,8 @@ module GHC.CmmToLlvm.Ppr ( import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Llvm import GHC.CmmToLlvm.Base import GHC.CmmToLlvm.Data diff --git a/compiler/GHC/CmmToLlvm/Regs.hs b/compiler/GHC/CmmToLlvm/Regs.hs index dc878fce30..411ec22bbb 100644 --- a/compiler/GHC/CmmToLlvm/Regs.hs +++ b/compiler/GHC/CmmToLlvm/Regs.hs @@ -18,7 +18,7 @@ import GHC.Llvm import GHC.Cmm.Expr import GHC.Platform import GHC.Data.FastString -import GHC.Utils.Outputable ( panic ) +import GHC.Utils.Panic ( panic ) import GHC.Types.Unique -- | Get the LlvmVar function variable storing the real register diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs index 5e13b4e275..c99182f978 100644 --- a/compiler/GHC/Core.hs +++ b/compiler/GHC/Core.hs @@ -114,11 +114,15 @@ import GHC.Types.Literal import GHC.Core.DataCon import GHC.Unit.Module import GHC.Types.Basic -import GHC.Utils.Outputable -import GHC.Utils.Misc import GHC.Types.Unique.Set import GHC.Types.SrcLoc ( RealSrcSpan, containsSpan ) + import GHC.Utils.Binary +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + +import GHC.Driver.Ppr import Data.Data hiding (TyCon) import Data.Int diff --git a/compiler/GHC/Core/Class.hs b/compiler/GHC/Core/Class.hs index 25df472486..f5d24aaf3c 100644 --- a/compiler/GHC/Core/Class.hs +++ b/compiler/GHC/Core/Class.hs @@ -33,6 +33,7 @@ import GHC.Types.Name import GHC.Types.Basic import GHC.Types.Unique import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Utils.Outputable import GHC.Data.BooleanFormula (BooleanFormula, mkTrue) diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs index a408373eea..6e19cbdd7a 100644 --- a/compiler/GHC/Core/Coercion.hs +++ b/compiler/GHC/Core/Coercion.hs @@ -139,9 +139,7 @@ import GHC.Types.Var import GHC.Types.Var.Env import GHC.Types.Var.Set import GHC.Types.Name hiding ( varName ) -import GHC.Utils.Misc import GHC.Types.Basic -import GHC.Utils.Outputable import GHC.Types.Unique import GHC.Data.Pair import GHC.Types.SrcLoc @@ -151,6 +149,10 @@ import GHC.Data.List.SetOps import GHC.Data.Maybe import GHC.Types.Unique.FM +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + import Control.Monad (foldM, zipWithM) import Data.Function ( on ) import Data.Char( isDigit ) diff --git a/compiler/GHC/Core/Coercion/Axiom.hs b/compiler/GHC/Core/Coercion/Axiom.hs index 7046273ae5..a1ace3ccfd 100644 --- a/compiler/GHC/Core/Coercion/Axiom.hs +++ b/compiler/GHC/Core/Coercion/Axiom.hs @@ -41,6 +41,7 @@ import GHC.Types.Unique import GHC.Types.Var import GHC.Utils.Misc import GHC.Utils.Binary +import GHC.Utils.Panic import GHC.Data.Pair import GHC.Types.Basic import Data.Typeable ( Typeable ) diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs index bb99f93ac6..2de2089904 100644 --- a/compiler/GHC/Core/Coercion/Opt.hs +++ b/compiler/GHC/Core/Coercion/Opt.hs @@ -9,6 +9,8 @@ module GHC.Core.Coercion.Opt ( optCoercion, checkAxInstCo ) where import GHC.Prelude import GHC.Driver.Session +import GHC.Driver.Ppr + import GHC.Core.TyCo.Rep import GHC.Core.TyCo.Subst import GHC.Core.Coercion @@ -18,15 +20,17 @@ import GHC.Core.TyCon import GHC.Core.Coercion.Axiom import GHC.Types.Var.Set import GHC.Types.Var.Env -import GHC.Utils.Outputable import GHC.Core.FamInstEnv ( flattenTys ) import GHC.Data.Pair import GHC.Data.List.SetOps ( getNth ) -import GHC.Utils.Misc import GHC.Core.Unify import GHC.Core.InstEnv import Control.Monad ( zipWithM ) +import GHC.Utils.Outputable +import GHC.Utils.Misc +import GHC.Utils.Panic + {- %************************************************************************ %* * diff --git a/compiler/GHC/Core/DataCon.hs b/compiler/GHC/Core/DataCon.hs index 3afa8180d8..6eb9723fe7 100644 --- a/compiler/GHC/Core/DataCon.hs +++ b/compiler/GHC/Core/DataCon.hs @@ -78,8 +78,6 @@ import GHC.Types.Name import GHC.Builtin.Names import GHC.Core.Predicate import GHC.Types.Var -import GHC.Utils.Outputable -import GHC.Utils.Misc import GHC.Types.Basic import GHC.Data.FastString import GHC.Unit @@ -87,6 +85,10 @@ import GHC.Utils.Binary import GHC.Types.Unique.Set import GHC.Types.Unique( mkAlphaTyVarUnique ) +import GHC.Utils.Outputable +import GHC.Utils.Misc +import GHC.Utils.Panic + import Data.ByteString (ByteString) import qualified Data.ByteString.Builder as BSB import qualified Data.ByteString.Lazy as LBS diff --git a/compiler/GHC/Core/FVs.hs b/compiler/GHC/Core/FVs.hs index b3fb267816..d3cbe267f6 100644 --- a/compiler/GHC/Core/FVs.hs +++ b/compiler/GHC/Core/FVs.hs @@ -79,10 +79,11 @@ import GHC.Core.FamInstEnv import GHC.Builtin.Types( unrestrictedFunTyConName ) import GHC.Builtin.Types.Prim( funTyConName ) import GHC.Data.Maybe( orElse ) -import GHC.Utils.Misc import GHC.Types.Basic( Activation ) -import GHC.Utils.Outputable + import GHC.Utils.FV as FV +import GHC.Utils.Misc +import GHC.Utils.Panic {- ************************************************************************ diff --git a/compiler/GHC/Core/FamInstEnv.hs b/compiler/GHC/Core/FamInstEnv.hs index a693927db4..75ad0a5574 100644 --- a/compiler/GHC/Core/FamInstEnv.hs +++ b/compiler/GHC/Core/FamInstEnv.hs @@ -53,11 +53,9 @@ import GHC.Types.Var.Set import GHC.Types.Var.Env import GHC.Types.Name import GHC.Types.Unique.DFM -import GHC.Utils.Outputable import GHC.Data.Maybe import GHC.Core.Map import GHC.Types.Unique -import GHC.Utils.Misc import GHC.Types.Var import GHC.Types.SrcLoc import GHC.Data.FastString @@ -65,6 +63,10 @@ import Control.Monad import Data.List( mapAccumL ) import Data.Array( Array, assocs ) +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + {- ************************************************************************ * * diff --git a/compiler/GHC/Core/InstEnv.hs b/compiler/GHC/Core/InstEnv.hs index 74295a738f..16c40cc73d 100644 --- a/compiler/GHC/Core/InstEnv.hs +++ b/compiler/GHC/Core/InstEnv.hs @@ -44,15 +44,17 @@ import GHC.Types.Name import GHC.Types.Name.Set import GHC.Types.Unique (getUnique) import GHC.Core.Unify -import GHC.Utils.Outputable -import GHC.Utils.Error import GHC.Types.Basic import GHC.Types.Unique.DFM -import GHC.Utils.Misc import GHC.Types.Id import Data.Data ( Data ) import Data.Maybe ( isJust, isNothing ) +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Error +import GHC.Utils.Panic + {- ************************************************************************ * * diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs index 04a839c6cd..a3582de953 100644 --- a/compiler/GHC/Core/Lint.hs +++ b/compiler/GHC/Core/Lint.hs @@ -64,6 +64,7 @@ import GHC.Utils.Error as Err import GHC.Data.List.SetOps import GHC.Builtin.Names import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Misc import GHC.Core.InstEnv ( instanceDFunId ) @@ -73,6 +74,7 @@ import GHC.Types.Demand ( splitStrictSig, isDeadEndDiv ) import GHC.Driver.Types hiding (Usage) import GHC.Driver.Session +import GHC.Driver.Ppr import Control.Monad import GHC.Utils.Monad import Data.Foldable ( toList ) diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs index 7bc9c161a5..c242c776e6 100644 --- a/compiler/GHC/Core/Make.hs +++ b/compiler/GHC/Core/Make.hs @@ -83,6 +83,7 @@ import GHC.Data.FastString import GHC.Types.Unique.Supply import GHC.Types.Basic import GHC.Utils.Misc +import GHC.Utils.Panic import Data.List import Data.Char ( ord ) diff --git a/compiler/GHC/Core/Map.hs b/compiler/GHC/Core/Map.hs index bf0b56ae40..092a5a9773 100644 --- a/compiler/GHC/Core/Map.hs +++ b/compiler/GHC/Core/Map.hs @@ -48,13 +48,15 @@ import GHC.Core.Type import GHC.Core.TyCo.Rep import GHC.Types.Var import GHC.Data.FastString(FastString) + import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic import qualified Data.Map as Map import qualified Data.IntMap as IntMap import GHC.Types.Var.Env import GHC.Types.Name.Env -import GHC.Utils.Outputable import Control.Monad( (>=>) ) {- diff --git a/compiler/GHC/Core/Opt/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs index 7891012792..829673433c 100644 --- a/compiler/GHC/Core/Opt/Arity.hs +++ b/compiler/GHC/Core/Opt/Arity.hs @@ -26,6 +26,8 @@ where import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Core import GHC.Core.FVs import GHC.Core.Utils @@ -44,6 +46,7 @@ import GHC.Types.Basic import GHC.Types.Unique import GHC.Driver.Session ( DynFlags, GeneralFlag(..), gopt ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Misc ( lengthAtLeast ) diff --git a/compiler/GHC/Core/Opt/CSE.hs b/compiler/GHC/Core/Opt/CSE.hs index 019b578db2..3f826621a6 100644 --- a/compiler/GHC/Core/Opt/CSE.hs +++ b/compiler/GHC/Core/Opt/CSE.hs @@ -32,6 +32,7 @@ import GHC.Utils.Outputable import GHC.Types.Basic import GHC.Core.Map import GHC.Utils.Misc ( filterOut, equalLength, debugIsOn ) +import GHC.Utils.Panic import Data.List ( mapAccumL ) {- diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs index e6d23f3d0a..94d469a515 100644 --- a/compiler/GHC/Core/Opt/ConstantFold.hs +++ b/compiler/GHC/Core/Opt/ConstantFold.hs @@ -29,6 +29,8 @@ where import GHC.Prelude +import GHC.Driver.Ppr + import {-# SOURCE #-} GHC.Types.Id.Make ( mkPrimOpId, magicDictId ) import GHC.Core @@ -61,6 +63,7 @@ import GHC.Data.FastString import GHC.Types.Basic import GHC.Platform import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Core.Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..)) import Control.Applicative ( Alternative(..) ) diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs index e11d220773..386a417cf9 100644 --- a/compiler/GHC/Core/Opt/DmdAnal.hs +++ b/compiler/GHC/Core/Opt/DmdAnal.hs @@ -35,6 +35,7 @@ import GHC.Core.Type import GHC.Core.Coercion ( Coercion, coVarsOfCo ) import GHC.Core.FamInstEnv import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.Maybe ( isJust ) import GHC.Builtin.PrimOps import GHC.Builtin.Types.Prim ( realWorldStatePrimTy ) diff --git a/compiler/GHC/Core/Opt/FloatIn.hs b/compiler/GHC/Core/Opt/FloatIn.hs index 896507d77a..d539e4f386 100644 --- a/compiler/GHC/Core/Opt/FloatIn.hs +++ b/compiler/GHC/Core/Opt/FloatIn.hs @@ -35,7 +35,7 @@ import GHC.Core.Type import GHC.Types.Var.Set import GHC.Utils.Misc import GHC.Driver.Session -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Basic ( RecFlag(..), isRec ) {- diff --git a/compiler/GHC/Core/Opt/FloatOut.hs b/compiler/GHC/Core/Opt/FloatOut.hs index 479bc1a9ce..be3cd1f1c4 100644 --- a/compiler/GHC/Core/Opt/FloatOut.hs +++ b/compiler/GHC/Core/Opt/FloatOut.hs @@ -28,6 +28,7 @@ import GHC.Data.Bag import GHC.Utils.Misc import GHC.Data.Maybe import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.Type import qualified Data.IntMap as M diff --git a/compiler/GHC/Core/Opt/Monad.hs b/compiler/GHC/Core/Opt/Monad.hs index aa651355f4..400cb00c83 100644 --- a/compiler/GHC/Core/Opt/Monad.hs +++ b/compiler/GHC/Core/Opt/Monad.hs @@ -78,7 +78,7 @@ import qualified Data.Map.Strict as MapStrict import Data.Word import Control.Monad import Control.Applicative ( Alternative(..) ) -import GHC.Utils.Panic (throwGhcException, GhcException(..)) +import GHC.Utils.Panic (throwGhcException, GhcException(..), panic) {- ************************************************************************ diff --git a/compiler/GHC/Core/Opt/OccurAnal.hs b/compiler/GHC/Core/Opt/OccurAnal.hs index 12ffcbb587..0180bec651 100644 --- a/compiler/GHC/Core/Opt/OccurAnal.hs +++ b/compiler/GHC/Core/Opt/OccurAnal.hs @@ -20,6 +20,8 @@ module GHC.Core.Opt.OccurAnal ( occurAnalysePgm, occurAnalyseExpr ) where import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Core import GHC.Core.FVs import GHC.Core.Utils ( exprIsTrivial, isDefaultAlt, isExpandableApp, @@ -46,6 +48,7 @@ import GHC.Types.Unique.Set import GHC.Utils.Misc import GHC.Data.Maybe( orElse, isJust ) import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.List {- diff --git a/compiler/GHC/Core/Opt/Pipeline.hs b/compiler/GHC/Core/Opt/Pipeline.hs index 76be316a3e..a9dc3ec4a5 100644 --- a/compiler/GHC/Core/Opt/Pipeline.hs +++ b/compiler/GHC/Core/Opt/Pipeline.hs @@ -13,6 +13,7 @@ module GHC.Core.Opt.Pipeline ( core2core, simplifyExpr ) where import GHC.Prelude import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Core import GHC.Driver.Types import GHC.Core.Opt.CSE ( cseProgram ) @@ -58,6 +59,7 @@ import GHC.Runtime.Loader -- ( initializePlugins ) import GHC.Types.Unique.Supply ( UniqSupply, mkSplitUniqSupply, splitUniqSupply ) import GHC.Types.Unique.FM import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad import qualified GHC.LanguageExtensions as LangExt {- diff --git a/compiler/GHC/Core/Opt/SetLevels.hs b/compiler/GHC/Core/Opt/SetLevels.hs index efcf96e6df..f678433568 100644 --- a/compiler/GHC/Core/Opt/SetLevels.hs +++ b/compiler/GHC/Core/Opt/SetLevels.hs @@ -77,6 +77,8 @@ module GHC.Core.Opt.SetLevels ( import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Core import GHC.Core.Opt.Monad ( FloatOutSwitches(..) ) import GHC.Core.Utils ( exprType, exprIsHNF @@ -114,6 +116,7 @@ import GHC.Builtin.Names ( runRWKey ) import GHC.Types.Unique.Supply import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.Unique.DFM import GHC.Utils.FV diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs index f9e9c57640..a529a8b0a4 100644 --- a/compiler/GHC/Core/Opt/Simplify.hs +++ b/compiler/GHC/Core/Opt/Simplify.hs @@ -15,6 +15,7 @@ import GHC.Prelude import GHC.Platform import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Core.Opt.Simplify.Monad import GHC.Core.Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) import GHC.Core.Opt.Simplify.Env @@ -58,6 +59,7 @@ import GHC.Types.Var ( isTyCoVar ) import GHC.Data.Maybe ( orElse ) import Control.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Misc import GHC.Utils.Error diff --git a/compiler/GHC/Core/Opt/Simplify/Env.hs b/compiler/GHC/Core/Opt/Simplify/Env.hs index 237739e23c..b0245162ee 100644 --- a/compiler/GHC/Core/Opt/Simplify/Env.hs +++ b/compiler/GHC/Core/Opt/Simplify/Env.hs @@ -59,6 +59,7 @@ import GHC.Data.OrdList import GHC.Types.Id as Id import GHC.Core.Make ( mkWildValBinder ) import GHC.Driver.Session ( DynFlags ) +import GHC.Driver.Ppr import GHC.Builtin.Types import GHC.Core.TyCo.Rep ( TyCoBinder(..) ) import qualified GHC.Core.Type as Type @@ -68,6 +69,7 @@ import GHC.Core.Coercion hiding ( substCo, substCoVar, substCoVarBndr ) import GHC.Types.Basic import GHC.Utils.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Types.Unique.FM ( pprUniqFM ) diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs index 210fd73701..febd937fdf 100644 --- a/compiler/GHC/Core/Opt/Simplify/Utils.hs +++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs @@ -44,6 +44,7 @@ import GHC.Prelude import GHC.Core.Opt.Simplify.Env import GHC.Core.Opt.Monad ( SimplMode(..), Tick(..) ) import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Core import qualified GHC.Core.Subst import GHC.Core.Ppr @@ -68,6 +69,7 @@ import GHC.Utils.Misc import GHC.Data.OrdList ( isNilOL ) import GHC.Utils.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.Opt.ConstantFold import GHC.Data.FastString ( fsLit ) diff --git a/compiler/GHC/Core/Opt/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs index 37f85c3822..6f7d61894e 100644 --- a/compiler/GHC/Core/Opt/SpecConstr.hs +++ b/compiler/GHC/Core/Opt/SpecConstr.hs @@ -42,6 +42,7 @@ import GHC.Types.Name import GHC.Types.Basic import GHC.Driver.Session ( DynFlags(..), GeneralFlag( Opt_SpecConstrKeen ) , gopt, hasPprDebug ) +import GHC.Driver.Ppr import GHC.Data.Maybe ( orElse, catMaybes, isJust, isNothing ) import GHC.Types.Demand import GHC.Types.Cpr @@ -49,6 +50,7 @@ import GHC.Utils.Misc import GHC.Data.Pair import GHC.Types.Unique.Supply import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.Unique.FM import GHC.Utils.Monad diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs index 935ba04bb5..a002630c08 100644 --- a/compiler/GHC/Core/Opt/Specialise.hs +++ b/compiler/GHC/Core/Opt/Specialise.hs @@ -46,8 +46,10 @@ import GHC.Types.Basic import GHC.Driver.Types import GHC.Data.Bag import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Monad.State import GHC.Types.Unique.DFM diff --git a/compiler/GHC/Core/Opt/StaticArgs.hs b/compiler/GHC/Core/Opt/StaticArgs.hs index d4b76dc0d8..91c8646f19 100644 --- a/compiler/GHC/Core/Opt/StaticArgs.hs +++ b/compiler/GHC/Core/Opt/StaticArgs.hs @@ -68,6 +68,7 @@ import GHC.Types.Var.Set import GHC.Types.Unique import GHC.Types.Unique.Set import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.List (mapAccumL) import GHC.Data.FastString diff --git a/compiler/GHC/Core/Opt/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs index acffd58c43..b1af5f9d62 100644 --- a/compiler/GHC/Core/Opt/WorkWrap.hs +++ b/compiler/GHC/Core/Opt/WorkWrap.hs @@ -21,11 +21,13 @@ import GHC.Core.Type import GHC.Types.Unique.Supply import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Types.Demand import GHC.Types.Cpr import GHC.Core.Opt.WorkWrap.Utils import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.FamInstEnv import GHC.Utils.Monad diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs index 2ccc743047..8cc0eaa503 100644 --- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs +++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs @@ -46,6 +46,7 @@ import GHC.Data.Maybe import GHC.Utils.Misc import GHC.Utils.Outputable import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import GHC.Data.List.SetOps diff --git a/compiler/GHC/Core/PatSyn.hs b/compiler/GHC/Core/PatSyn.hs index 3902bb6b18..b07b8265a7 100644 --- a/compiler/GHC/Core/PatSyn.hs +++ b/compiler/GHC/Core/PatSyn.hs @@ -30,13 +30,15 @@ import GHC.Prelude import GHC.Core.Type import GHC.Core.TyCo.Ppr import GHC.Types.Name -import GHC.Utils.Outputable import GHC.Types.Unique -import GHC.Utils.Misc import GHC.Types.Basic import GHC.Types.Var import GHC.Types.FieldLabel +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + import qualified Data.Data as Data import Data.Function import Data.List (find) diff --git a/compiler/GHC/Core/Ppr/TyThing.hs b/compiler/GHC/Core/Ppr/TyThing.hs index a9231f8499..5a7a60acd2 100644 --- a/compiler/GHC/Core/Ppr/TyThing.hs +++ b/compiler/GHC/Core/Ppr/TyThing.hs @@ -26,6 +26,7 @@ import GHC.Iface.Syntax ( ShowSub(..), ShowHowMuch(..), AltPpr(..) , showToHeader, pprIfaceDecl ) import GHC.Core.Coercion.Axiom ( coAxiomTyCon ) import GHC.Driver.Types( tyThingParent_maybe ) +import GHC.Driver.Ppr import GHC.Iface.Make ( tyThingToIfaceDecl ) import GHC.Core.FamInstEnv( FamInst(..), FamFlavor(..) ) import GHC.Core.TyCo.Ppr ( pprUserForAll, pprTypeApp, pprSigmaType ) diff --git a/compiler/GHC/Core/Predicate.hs b/compiler/GHC/Core/Predicate.hs index dda9e24db2..eb31c1be06 100644 --- a/compiler/GHC/Core/Predicate.hs +++ b/compiler/GHC/Core/Predicate.hs @@ -35,13 +35,14 @@ import GHC.Core.Class import GHC.Core.TyCon import GHC.Types.Var import GHC.Core.Coercion +import GHC.Core.Multiplicity ( scaledThing ) import GHC.Builtin.Names import GHC.Data.FastString import GHC.Utils.Outputable import GHC.Utils.Misc -import GHC.Core.Multiplicity ( scaledThing ) +import GHC.Utils.Panic import Control.Monad ( guard ) diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs index acfa93efaa..4ad942c212 100644 --- a/compiler/GHC/Core/Rules.hs +++ b/compiler/GHC/Core/Rules.hs @@ -60,8 +60,10 @@ import GHC.Types.Unique.FM import GHC.Core.Unify as Unify ( ruleMatchTyKiX ) import GHC.Types.Basic import GHC.Driver.Session ( DynFlags, gopt, targetPlatform ) +import GHC.Driver.Ppr import GHC.Driver.Flags import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Maybe import GHC.Data.Bag diff --git a/compiler/GHC/Core/SimpleOpt.hs b/compiler/GHC/Core/SimpleOpt.hs index ab3eed4b60..b040626f63 100644 --- a/compiler/GHC/Core/SimpleOpt.hs +++ b/compiler/GHC/Core/SimpleOpt.hs @@ -54,7 +54,9 @@ import GHC.Types.Basic import GHC.Unit.Module ( Module ) import GHC.Utils.Error import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Pair import GHC.Utils.Misc import GHC.Data.Maybe ( orElse ) diff --git a/compiler/GHC/Core/Subst.hs b/compiler/GHC/Core/Subst.hs index 04ef9ef150..f1d104df66 100644 --- a/compiler/GHC/Core/Subst.hs +++ b/compiler/GHC/Core/Subst.hs @@ -39,6 +39,8 @@ module GHC.Core.Subst ( import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Core import GHC.Core.FVs import GHC.Core.Seq @@ -63,6 +65,7 @@ import GHC.Types.Unique.Supply import GHC.Data.Maybe import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.List diff --git a/compiler/GHC/Core/TyCo/Ppr.hs b/compiler/GHC/Core/TyCo/Ppr.hs index d48cf84c4e..dcfb9f2557 100644 --- a/compiler/GHC/Core/TyCo/Ppr.hs +++ b/compiler/GHC/Core/TyCo/Ppr.hs @@ -52,6 +52,7 @@ import GHC.Types.Var.Set import GHC.Types.Var.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Basic ( PprPrec(..), topPrec, sigPrec, opPrec , funPrec, appPrec, maybeParen ) diff --git a/compiler/GHC/Core/TyCo/Rep.hs b/compiler/GHC/Core/TyCo/Rep.hs index 61a374b38e..5931d8c94a 100644 --- a/compiler/GHC/Core/TyCo/Rep.hs +++ b/compiler/GHC/Core/TyCo/Rep.hs @@ -99,6 +99,7 @@ import GHC.Types.Unique ( hasKey ) import GHC.Utils.Outputable import GHC.Data.FastString import GHC.Utils.Misc +import GHC.Utils.Panic -- libraries import qualified Data.Data as Data hiding ( TyCon ) diff --git a/compiler/GHC/Core/TyCo/Subst.hs b/compiler/GHC/Core/TyCo/Subst.hs index b3f51739b5..3e8ef37bba 100644 --- a/compiler/GHC/Core/TyCo/Subst.hs +++ b/compiler/GHC/Core/TyCo/Subst.hs @@ -81,6 +81,7 @@ import GHC.Types.Unique import GHC.Types.Unique.FM import GHC.Types.Unique.Set import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.List (mapAccumL) diff --git a/compiler/GHC/Core/TyCon.hs b/compiler/GHC/Core/TyCon.hs index e4f31e9fe0..2c7cd2d5de 100644 --- a/compiler/GHC/Core/TyCon.hs +++ b/compiler/GHC/Core/TyCon.hs @@ -162,6 +162,7 @@ import GHC.Core.Coercion.Axiom import GHC.Builtin.Names import GHC.Data.Maybe import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString.Env import GHC.Types.FieldLabel import GHC.Settings.Constants diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs index c00c818ca5..3c6114ebd5 100644 --- a/compiler/GHC/Core/Type.hs +++ b/compiler/GHC/Core/Type.hs @@ -276,6 +276,7 @@ import {-# SOURCE #-} GHC.Core.Coercion import GHC.Utils.Misc import GHC.Utils.FV import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Pair import GHC.Data.List.SetOps diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs index 5795ca0036..4792545df7 100644 --- a/compiler/GHC/Core/Unfold.hs +++ b/compiler/GHC/Core/Unfold.hs @@ -47,6 +47,7 @@ module GHC.Core.Unfold ( import GHC.Prelude import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Core import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr ) import GHC.Core.SimpleOpt @@ -65,6 +66,7 @@ import GHC.Builtin.Types.Prim ( realWorldStatePrimTy ) import GHC.Data.Bag import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.ForeignCall import GHC.Types.Name import GHC.Utils.Error diff --git a/compiler/GHC/Core/UsageEnv.hs b/compiler/GHC/Core/UsageEnv.hs index 867b9533f0..e88b55560d 100644 --- a/compiler/GHC/Core/UsageEnv.hs +++ b/compiler/GHC/Core/UsageEnv.hs @@ -9,6 +9,7 @@ import GHC.Core.Multiplicity import GHC.Types.Name import GHC.Types.Name.Env import GHC.Utils.Outputable +import GHC.Utils.Panic -- -- * Usage environments diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index 0095eef0fe..3feb275843 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -71,6 +71,8 @@ module GHC.Core.Utils ( import GHC.Prelude import GHC.Platform +import GHC.Driver.Ppr + import GHC.Core import GHC.Builtin.Names ( makeStaticName, unsafeEqualityProofName ) import GHC.Core.Ppr @@ -94,6 +96,7 @@ import GHC.Core.TyCon import GHC.Core.Multiplicity import GHC.Types.Unique import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Builtin.Types.Prim import GHC.Data.FastString import GHC.Data.Maybe diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs index 2992fa5c0f..f9a11fe716 100644 --- a/compiler/GHC/CoreToIface.hs +++ b/compiler/GHC/CoreToIface.hs @@ -48,6 +48,7 @@ module GHC.CoreToIface import GHC.Prelude +import GHC.Driver.Ppr import GHC.Iface.Syntax import GHC.Core.DataCon import GHC.Types.Id @@ -66,6 +67,7 @@ import GHC.Core.Type import GHC.Core.Multiplicity import GHC.Core.PatSyn import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Misc import GHC.Types.Var diff --git a/compiler/GHC/CoreToStg.hs b/compiler/GHC/CoreToStg.hs index 871dd1d139..1abeb56fb7 100644 --- a/compiler/GHC/CoreToStg.hs +++ b/compiler/GHC/CoreToStg.hs @@ -41,8 +41,10 @@ import GHC.Utils.Outputable import GHC.Utils.Monad import GHC.Data.FastString import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Driver.Session import GHC.Platform.Ways +import GHC.Driver.Ppr import GHC.Types.ForeignCall import GHC.Types.Demand ( isUsedOnce ) import GHC.Builtin.PrimOps ( PrimCall(..) ) diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index 823d5418aa..831517f21c 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -24,6 +24,7 @@ import GHC.Platform import GHC.Core.Opt.OccurAnal import GHC.Driver.Types +import GHC.Driver.Ppr import GHC.Builtin.Names import GHC.Types.Id.Make ( realWorldPrimId ) import GHC.Core.Utils @@ -55,6 +56,7 @@ import GHC.Utils.Error import GHC.Driver.Session import GHC.Platform.Ways import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Utils.Outputable import GHC.Data.FastString import GHC.Types.Name ( NamedThing(..), nameSrcSpan, isInternalName ) diff --git a/compiler/GHC/Data/Graph/Color.hs b/compiler/GHC/Data/Graph/Color.hs index e4189acb61..4f7d74df40 100644 --- a/compiler/GHC/Data/Graph/Color.hs +++ b/compiler/GHC/Data/Graph/Color.hs @@ -25,6 +25,7 @@ import GHC.Types.Unique import GHC.Types.Unique.FM import GHC.Types.Unique.Set import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.Maybe import Data.List diff --git a/compiler/GHC/Data/Graph/Directed.hs b/compiler/GHC/Data/Graph/Directed.hs index 5bd08b9641..806460d6df 100644 --- a/compiler/GHC/Data/Graph/Directed.hs +++ b/compiler/GHC/Data/Graph/Directed.hs @@ -46,6 +46,7 @@ import GHC.Prelude import GHC.Utils.Misc ( minWith, count ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Maybe ( expectJust ) -- std interfaces diff --git a/compiler/GHC/Data/Graph/Ops.hs b/compiler/GHC/Data/Graph/Ops.hs index 99e4a7eea0..b6bce8a97c 100644 --- a/compiler/GHC/Data/Graph/Ops.hs +++ b/compiler/GHC/Data/Graph/Ops.hs @@ -41,6 +41,7 @@ import GHC.Prelude import GHC.Data.Graph.Base import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Types.Unique.Set import GHC.Types.Unique.FM diff --git a/compiler/GHC/Data/List/SetOps.hs b/compiler/GHC/Data/List/SetOps.hs index 15b370582c..a2fe5744f7 100644 --- a/compiler/GHC/Data/List/SetOps.hs +++ b/compiler/GHC/Data/List/SetOps.hs @@ -28,7 +28,9 @@ module GHC.Data.List.SetOps ( import GHC.Prelude import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc +import GHC.Driver.Ppr import qualified Data.List as L import qualified Data.List.NonEmpty as NE diff --git a/compiler/GHC/Data/OrdList.hs b/compiler/GHC/Data/OrdList.hs index 5476055f05..cc80b18d14 100644 --- a/compiler/GHC/Data/OrdList.hs +++ b/compiler/GHC/Data/OrdList.hs @@ -22,6 +22,7 @@ import GHC.Prelude import Data.Foldable import GHC.Utils.Outputable +import GHC.Utils.Panic import qualified Data.Semigroup as Semigroup diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs index acde752f66..c103955ab8 100644 --- a/compiler/GHC/Driver/Backpack.hs +++ b/compiler/GHC/Driver/Backpack.hs @@ -29,6 +29,7 @@ import GHC.Parser import GHC.Parser.Lexer import GHC.Driver.Monad import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Tc.Utils.Monad import GHC.Tc.Module import GHC.Unit @@ -561,7 +562,7 @@ type PackageNameMap a = Map PackageName a -- to use this for anything unitDefines :: UnitState -> LHsUnit PackageName -> (PackageName, HsComponentId) unitDefines pkgstate (L _ HsUnit{ hsunitName = L _ pn@(PackageName fs) }) - = (pn, HsComponentId pn (mkIndefUnitId pkgstate fs)) + = (pn, HsComponentId pn (updateIndefUnitId pkgstate (Indefinite (UnitId fs) Nothing))) bkpPackageNameMap :: UnitState -> [LHsUnit PackageName] -> PackageNameMap HsComponentId bkpPackageNameMap pkgstate units = Map.fromList (map (unitDefines pkgstate) units) diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs index 19485eaf5c..f752449210 100644 --- a/compiler/GHC/Driver/CodeOutput.hs +++ b/compiler/GHC/Driver/CodeOutput.hs @@ -30,12 +30,14 @@ import GHC.Cmm ( RawCmmGroup ) import GHC.Cmm.CLabel import GHC.Driver.Types import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.Stream ( Stream ) import qualified GHC.Data.Stream as Stream import GHC.SysTools.FileCleanup import GHC.Utils.Error import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Unit import GHC.Types.SrcLoc import GHC.Types.CostCentre diff --git a/compiler/GHC/Driver/Finder.hs b/compiler/GHC/Driver/Finder.hs index f572fa41db..22408ca149 100644 --- a/compiler/GHC/Driver/Finder.hs +++ b/compiler/GHC/Driver/Finder.hs @@ -44,6 +44,7 @@ import GHC.Builtin.Names ( gHC_PRIM ) import GHC.Driver.Session import GHC.Platform.Ways import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.Maybe ( expectJust ) import Data.IORef ( IORef, readIORef, atomicModifyIORef' ) diff --git a/compiler/GHC/Driver/MakeFile.hs b/compiler/GHC/Driver/MakeFile.hs index cd1a2d6ffa..a393bdbba4 100644 --- a/compiler/GHC/Driver/MakeFile.hs +++ b/compiler/GHC/Driver/MakeFile.hs @@ -20,6 +20,7 @@ import GHC.Prelude import qualified GHC import GHC.Driver.Monad import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Misc import GHC.Driver.Types import qualified GHC.SysTools as SysTools diff --git a/compiler/GHC/Driver/Phases.hs b/compiler/GHC/Driver/Phases.hs index cfca2e87c1..4892b20c60 100644 --- a/compiler/GHC/Driver/Phases.hs +++ b/compiler/GHC/Driver/Phases.hs @@ -42,6 +42,7 @@ module GHC.Driver.Phases ( import GHC.Prelude import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Platform import System.FilePath import GHC.Utils.Binary diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index e422624fa6..f87fd1380d 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -55,6 +55,7 @@ import GHC.Unit.Module import GHC.Utils.Error import GHC.Driver.Session import GHC.Driver.Backend +import GHC.Driver.Ppr import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Data.StringBuffer ( hGetStringBuffer, hPutStringBuffer ) diff --git a/compiler/GHC/Driver/Ppr.hs b/compiler/GHC/Driver/Ppr.hs new file mode 100644 index 0000000000..fe95b56860 --- /dev/null +++ b/compiler/GHC/Driver/Ppr.hs @@ -0,0 +1,132 @@ +-- | Printing related functions that depend on session state (DynFlags) +module GHC.Driver.Ppr + ( showSDoc + , showSDocForUser + , showSDocDebug + , showSDocDump + , showPpr + , showPprUnsafe + , pprDebugAndThen + , printForUser + , printForC + -- ** Trace + , warnPprTrace + , pprTrace + , pprTraceWithFlags + , pprTraceM + , pprTraceDebug + , pprTraceIt + , pprSTrace + , pprTraceException + ) +where + +import GHC.Prelude + +import {-# SOURCE #-} GHC.Driver.Session + +import GHC.Utils.Exception +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic +import GHC.Utils.Ppr ( Mode(..) ) + +import System.IO ( Handle ) +import Control.Monad.IO.Class + +-- | Show a SDoc as a String with the default user style +showSDoc :: DynFlags -> SDoc -> String +showSDoc dflags sdoc = renderWithStyle (initSDocContext dflags defaultUserStyle) sdoc + +showPpr :: Outputable a => DynFlags -> a -> String +showPpr dflags thing = showSDoc dflags (ppr thing) + +showPprUnsafe :: Outputable a => a -> String +showPprUnsafe a = showPpr unsafeGlobalDynFlags a + +-- | Allows caller to specify the PrintUnqualified to use +showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String +showSDocForUser dflags unqual doc = renderWithStyle (initSDocContext dflags (mkUserStyle unqual AllTheWay)) doc + +showSDocDump :: DynFlags -> SDoc -> String +showSDocDump dflags d = renderWithStyle (initSDocContext dflags defaultDumpStyle) d + +showSDocDebug :: DynFlags -> SDoc -> String +showSDocDebug dflags d = renderWithStyle ctx d + where + ctx = (initSDocContext dflags defaultDumpStyle) + { sdocPprDebug = True + } + +printForUser :: DynFlags -> Handle -> PrintUnqualified -> Depth -> SDoc -> IO () +printForUser dflags handle unqual depth doc + = printSDocLn ctx PageMode handle doc + where ctx = initSDocContext dflags (mkUserStyle unqual depth) + +-- | Like 'printSDocLn' but specialized with 'LeftMode' and +-- @'PprCode' 'CStyle'@. This is typically used to output C-- code. +printForC :: DynFlags -> Handle -> SDoc -> IO () +printForC dflags handle doc = + printSDocLn ctx LeftMode handle doc + where ctx = initSDocContext dflags (PprCode CStyle) + +pprDebugAndThen :: DynFlags -> (String -> a) -> SDoc -> SDoc -> a +pprDebugAndThen dflags cont heading pretty_msg + = cont (showSDocDump dflags doc) + where + doc = sep [heading, nest 2 pretty_msg] + +-- | If debug output is on, show some 'SDoc' on the screen +pprTraceWithFlags :: DynFlags -> String -> SDoc -> a -> a +pprTraceWithFlags dflags str doc x + | hasNoDebugOutput dflags = x + | otherwise = pprDebugAndThen dflags trace (text str) doc x + +-- | If debug output is on, show some 'SDoc' on the screen +pprTrace :: String -> SDoc -> a -> a +pprTrace str doc x = pprTraceWithFlags unsafeGlobalDynFlags str doc x + +pprTraceM :: Applicative f => String -> SDoc -> f () +pprTraceM str doc = pprTrace str doc (pure ()) + +pprTraceDebug :: String -> SDoc -> a -> a +pprTraceDebug str doc x + | debugIsOn && hasPprDebug unsafeGlobalDynFlags = pprTrace str doc x + | otherwise = x + +-- | @pprTraceWith desc f x@ is equivalent to @pprTrace desc (f x) x@. +-- This allows you to print details from the returned value as well as from +-- ambient variables. +pprTraceWith :: String -> (a -> SDoc) -> a -> a +pprTraceWith desc f x = pprTrace desc (f x) x + +-- | @pprTraceIt desc x@ is equivalent to @pprTrace desc (ppr x) x@ +pprTraceIt :: Outputable a => String -> a -> a +pprTraceIt desc x = pprTraceWith desc ppr x + +-- | @pprTraceException desc x action@ runs action, printing a message +-- if it throws an exception. +pprTraceException :: ExceptionMonad m => String -> SDoc -> m a -> m a +pprTraceException heading doc = + handleGhcException $ \exc -> liftIO $ do + putStrLn $ showSDocDump unsafeGlobalDynFlags (sep [text heading, nest 2 doc]) + throwGhcExceptionIO exc + +-- | If debug output is on, show some 'SDoc' on the screen along +-- with a call stack when available. +pprSTrace :: HasCallStack => SDoc -> a -> a +pprSTrace doc = pprTrace "" (doc $$ callStackDoc) + +warnPprTrace :: HasCallStack => Bool -> String -> Int -> SDoc -> a -> a +-- ^ Just warn about an assertion failure, recording the given file and line number. +-- Should typically be accessed with the WARN macros +warnPprTrace _ _ _ _ x | not debugIsOn = x +warnPprTrace _ _file _line _msg x + | hasNoDebugOutput unsafeGlobalDynFlags = x +warnPprTrace False _file _line _msg x = x +warnPprTrace True file line msg x + = pprDebugAndThen unsafeGlobalDynFlags trace heading + (msg $$ callStackDoc ) + x + where + heading = hsep [text "WARNING: file", text file <> comma, text "line", int line] diff --git a/compiler/GHC/Driver/Ppr.hs-boot b/compiler/GHC/Driver/Ppr.hs-boot new file mode 100644 index 0000000000..a1f864bda8 --- /dev/null +++ b/compiler/GHC/Driver/Ppr.hs-boot @@ -0,0 +1,9 @@ +module GHC.Driver.Ppr where + +import GHC.Prelude +import GHC.Stack +import {-# SOURCE #-} GHC.Driver.Session +import {-# SOURCE #-} GHC.Utils.Outputable + +showSDoc :: DynFlags -> SDoc -> String +warnPprTrace :: HasCallStack => Bool -> String -> Int -> SDoc -> a -> a diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 69972fdef4..5ec163c54a 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -244,6 +244,7 @@ import GHC.UniqueSubdir (uniqueSubdir) import GHC.Unit.Types import GHC.Unit.Parser import GHC.Unit.Module +import GHC.Driver.Ppr import {-# SOURCE #-} GHC.Driver.Plugins import {-# SOURCE #-} GHC.Driver.Hooks import GHC.Builtin.Names ( mAIN ) @@ -5129,7 +5130,6 @@ data FilesToClean = FilesToClean { emptyFilesToClean :: FilesToClean emptyFilesToClean = FilesToClean Set.empty Set.empty - -- | Initialize the pretty-printing options initSDocContext :: DynFlags -> PprStyle -> SDocContext initSDocContext dflags style = SDC @@ -5172,3 +5172,4 @@ initSDocContext dflags style = SDC -- | Initialize the pretty-printing options using the default user style initDefaultSDocContext :: DynFlags -> SDocContext initDefaultSDocContext dflags = initSDocContext dflags defaultUserStyle + diff --git a/compiler/GHC/Driver/Types.hs b/compiler/GHC/Driver/Types.hs index 4029ab1c2c..e6cc556121 100644 --- a/compiler/GHC/Driver/Types.hs +++ b/compiler/GHC/Driver/Types.hs @@ -161,6 +161,10 @@ module GHC.Driver.Types ( import GHC.Prelude +import GHC.Driver.Ppr +import GHC.Driver.CmdLine +import GHC.Driver.Session + import GHC.ByteCode.Types import GHC.Runtime.Eval.Types ( Resume ) import GHC.Runtime.Interpreter.Types (Interp) @@ -193,8 +197,6 @@ import GHC.Core.PatSyn import GHC.Builtin.Names ( gHC_PRIM, ioTyConName, printName, mkInteractiveModule ) import GHC.Builtin.Types import GHC.Driver.Backend -import GHC.Driver.CmdLine -import GHC.Driver.Session import GHC.Runtime.Linker.Types ( DynLinker, Linkable(..), Unlinked(..), SptEntry(..) ) import GHC.Driver.Phases ( Phase, HscSource(..), hscSourceString @@ -214,6 +216,7 @@ import GHC.Utils.Monad import GHC.Data.Bag import GHC.Utils.Binary import GHC.Utils.Error +import GHC.Utils.Panic import GHC.Types.Name.Cache import GHC.Platform import GHC.Utils.Misc diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index 07b561ce08..0933e9ba7e 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -38,13 +38,15 @@ import GHC.Tc.Types.Evidence import GHC.Core.Type import GHC.Types.Name.Set import GHC.Types.Basic -import GHC.Utils.Outputable import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Var import GHC.Data.Bag import GHC.Data.FastString import GHC.Data.BooleanFormula (LBooleanFormula) +import GHC.Utils.Outputable +import GHC.Utils.Panic + import Data.Data hiding ( Fixity ) import Data.List hiding ( foldr ) import Data.Function diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index ca8d36c479..aa4d41b4b9 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -117,6 +117,7 @@ import GHC.Types.Name.Set import GHC.Core.Class import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Core.Type diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index cb1b75a725..d08e2079b0 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -48,6 +48,7 @@ import GHC.Types.SrcLoc import GHC.Unit.Module (ModuleName) import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Core.Type import GHC.Builtin.Types (mkTupleStr) diff --git a/compiler/GHC/Hs/Extension.hs b/compiler/GHC/Hs/Extension.hs index cb235cdf37..4f7ba57552 100644 --- a/compiler/GHC/Hs/Extension.hs +++ b/compiler/GHC/Hs/Extension.hs @@ -33,6 +33,7 @@ import GHC.Types.Name.Reader import GHC.Types.Var import GHC.Utils.Outputable import GHC.Types.SrcLoc (Located, unLoc, noLoc) +import GHC.Utils.Panic import Data.Kind diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 190dd63604..aeb9131e30 100644 --- a/compiler/GHC/Hs/ImpExp.hs +++ b/compiler/GHC/Hs/ImpExp.hs @@ -25,6 +25,7 @@ import GHC.Types.Basic ( SourceText(..), StringLiteral(..), pprWithSource import GHC.Types.FieldLabel ( FieldLbl(..) ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.SrcLoc import GHC.Hs.Extension diff --git a/compiler/GHC/Hs/Lit.hs b/compiler/GHC/Hs/Lit.hs index 4396e78004..a529b138fb 100644 --- a/compiler/GHC/Hs/Lit.hs +++ b/compiler/GHC/Hs/Lit.hs @@ -28,6 +28,7 @@ import GHC.Types.Basic , PprPrec(..), topPrec ) import GHC.Core.Type import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Hs.Extension diff --git a/compiler/GHC/Hs/Stats.hs b/compiler/GHC/Hs/Stats.hs index 9d7f8e8384..d0737859c1 100644 --- a/compiler/GHC/Hs/Stats.hs +++ b/compiler/GHC/Hs/Stats.hs @@ -14,9 +14,11 @@ import GHC.Prelude import GHC.Data.Bag import GHC.Hs -import GHC.Utils.Outputable import GHC.Types.SrcLoc + +import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Char diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index 04554ef2f9..188f9e63fd 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -131,11 +131,13 @@ import GHC.Types.Name.Env import GHC.Types.Basic import GHC.Types.SrcLoc import GHC.Data.FastString -import GHC.Utils.Misc import GHC.Data.Bag -import GHC.Utils.Outputable import GHC.Settings.Constants +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + import Data.Either import Data.Function import Data.List diff --git a/compiler/GHC/HsToCore.hs b/compiler/GHC/HsToCore.hs index 39301cf41b..3d96b38ccc 100644 --- a/compiler/GHC/HsToCore.hs +++ b/compiler/GHC/HsToCore.hs @@ -61,6 +61,7 @@ import GHC.Types.Var.Set import GHC.Data.FastString import GHC.Utils.Error import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.HsToCore.Coverage import GHC.Utils.Misc diff --git a/compiler/GHC/HsToCore/Arrows.hs b/compiler/GHC/HsToCore/Arrows.hs index 4f9871d412..6668e9a11b 100644 --- a/compiler/GHC/HsToCore/Arrows.hs +++ b/compiler/GHC/HsToCore/Arrows.hs @@ -52,6 +52,7 @@ import GHC.Builtin.Types import GHC.Types.Basic import GHC.Builtin.Names import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Var.Set import GHC.Types.SrcLoc import GHC.Data.List.SetOps( assocMaybe ) diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs index 03164c5b25..2a61406792 100644 --- a/compiler/GHC/HsToCore/Binds.hs +++ b/compiler/GHC/HsToCore/Binds.hs @@ -63,6 +63,7 @@ import GHC.Core.Rules import GHC.Types.Var.Env import GHC.Types.Var( EvVar ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Unit.Module import GHC.Types.SrcLoc import GHC.Data.Maybe @@ -70,6 +71,7 @@ import GHC.Data.OrdList import GHC.Data.Bag import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import GHC.Utils.Misc import GHC.Types.Unique.Set( nonDetEltsUniqSet ) diff --git a/compiler/GHC/HsToCore/Coverage.hs b/compiler/GHC/HsToCore/Coverage.hs index fefbf2b707..35cf0d4b96 100644 --- a/compiler/GHC/HsToCore/Coverage.hs +++ b/compiler/GHC/HsToCore/Coverage.hs @@ -23,8 +23,10 @@ import GHC.Core.Type import GHC.Hs import GHC.Unit import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Driver.Session import GHC.Driver.Backend +import GHC.Driver.Ppr import GHC.Core.ConLike import Control.Monad import GHC.Types.SrcLoc diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs index ffa4e9323f..be6c207dd6 100644 --- a/compiler/GHC/HsToCore/Expr.hs +++ b/compiler/GHC/HsToCore/Expr.hs @@ -66,6 +66,7 @@ import GHC.Types.SrcLoc import GHC.Utils.Misc import GHC.Data.Bag import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Core.PatSyn import Control.Monad diff --git a/compiler/GHC/HsToCore/Foreign/Call.hs b/compiler/GHC/HsToCore/Foreign/Call.hs index 102f2b3697..317c0b9477 100644 --- a/compiler/GHC/HsToCore/Foreign/Call.hs +++ b/compiler/GHC/HsToCore/Foreign/Call.hs @@ -50,6 +50,7 @@ import GHC.Builtin.Names import GHC.Driver.Session import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Maybe diff --git a/compiler/GHC/HsToCore/Foreign/Decl.hs b/compiler/GHC/HsToCore/Foreign/Decl.hs index 71d9eff7f2..2790137912 100644 --- a/compiler/GHC/HsToCore/Foreign/Decl.hs +++ b/compiler/GHC/HsToCore/Foreign/Decl.hs @@ -43,6 +43,7 @@ import GHC.Tc.Utils.TcType import GHC.Cmm.Expr import GHC.Cmm.Utils import GHC.Driver.Types +import GHC.Driver.Ppr import GHC.Types.ForeignCall import GHC.Builtin.Types import GHC.Builtin.Types.Prim @@ -55,6 +56,7 @@ import GHC.Driver.Session import GHC.Platform import GHC.Data.OrdList import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Driver.Hooks import GHC.Utils.Encoding diff --git a/compiler/GHC/HsToCore/GuardedRHSs.hs b/compiler/GHC/HsToCore/GuardedRHSs.hs index 8a991e9ceb..88439c9e0c 100644 --- a/compiler/GHC/HsToCore/GuardedRHSs.hs +++ b/compiler/GHC/HsToCore/GuardedRHSs.hs @@ -30,6 +30,7 @@ import GHC.Core.Type ( Type ) import GHC.Utils.Misc import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.Multiplicity import Control.Monad ( zipWithM ) import Data.List.NonEmpty ( NonEmpty, toList ) diff --git a/compiler/GHC/HsToCore/ListComp.hs b/compiler/GHC/HsToCore/ListComp.hs index 174d0a27af..0ecff073fc 100644 --- a/compiler/GHC/HsToCore/ListComp.hs +++ b/compiler/GHC/HsToCore/ListComp.hs @@ -35,6 +35,7 @@ import GHC.HsToCore.Match import GHC.Builtin.Names import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Tc.Utils.TcType import GHC.Data.List.SetOps( getNth ) import GHC.Utils.Misc diff --git a/compiler/GHC/HsToCore/Match.hs b/compiler/GHC/HsToCore/Match.hs index 5dc7328879..bc28e2110d 100644 --- a/compiler/GHC/HsToCore/Match.hs +++ b/compiler/GHC/HsToCore/Match.hs @@ -59,6 +59,7 @@ import GHC.Data.Maybe import GHC.Utils.Misc import GHC.Types.Name import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Basic ( isGenerated, il_value, fl_value, Boxity(..) ) import GHC.Data.FastString import GHC.Types.Unique diff --git a/compiler/GHC/HsToCore/Match/Constructor.hs b/compiler/GHC/HsToCore/Match/Constructor.hs index 96ab10fa4c..107c072580 100644 --- a/compiler/GHC/HsToCore/Match/Constructor.hs +++ b/compiler/GHC/HsToCore/Match/Constructor.hs @@ -36,6 +36,7 @@ import GHC.Types.Name.Env import GHC.Types.FieldLabel ( flSelector ) import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad(liftM) import Data.List (groupBy) import Data.List.NonEmpty (NonEmpty(..)) diff --git a/compiler/GHC/HsToCore/Match/Literal.hs b/compiler/GHC/HsToCore/Match/Literal.hs index 8b651443d2..a56f729f5e 100644 --- a/compiler/GHC/HsToCore/Match/Literal.hs +++ b/compiler/GHC/HsToCore/Match/Literal.hs @@ -53,6 +53,7 @@ import GHC.Utils.Outputable as Outputable import GHC.Types.Basic import GHC.Driver.Session import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.FastString import qualified GHC.LanguageExtensions as LangExt import GHC.Core.FamInstEnv ( FamInstEnvs, normaliseType ) diff --git a/compiler/GHC/HsToCore/Monad.hs b/compiler/GHC/HsToCore/Monad.hs index f803939da6..c78b35f6f2 100644 --- a/compiler/GHC/HsToCore/Monad.hs +++ b/compiler/GHC/HsToCore/Monad.hs @@ -84,7 +84,9 @@ import GHC.Types.Unique.Supply import GHC.Types.Name import GHC.Types.Name.Env import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Error +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.Unique.FM ( lookupWithDefaultUFM_Directly ) import GHC.Types.Literal ( mkLitString ) diff --git a/compiler/GHC/HsToCore/PmCheck.hs b/compiler/GHC/HsToCore/PmCheck.hs index 67667ab90f..564aa12f04 100644 --- a/compiler/GHC/HsToCore/PmCheck.hs +++ b/compiler/GHC/HsToCore/PmCheck.hs @@ -41,6 +41,7 @@ import GHC.Builtin.Types import GHC.Types.SrcLoc import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.DataCon import GHC.Core.TyCon import GHC.Types.Var (EvVar) diff --git a/compiler/GHC/HsToCore/PmCheck/Oracle.hs b/compiler/GHC/HsToCore/PmCheck/Oracle.hs index 361ea04971..0a03b05228 100644 --- a/compiler/GHC/HsToCore/PmCheck/Oracle.hs +++ b/compiler/GHC/HsToCore/PmCheck/Oracle.hs @@ -33,6 +33,7 @@ import GHC.Driver.Session import GHC.Utils.Outputable import GHC.Utils.Error import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.Bag import GHC.Types.Unique.Set import GHC.Types.Unique.DSet diff --git a/compiler/GHC/HsToCore/PmCheck/Ppr.hs b/compiler/GHC/HsToCore/PmCheck/Ppr.hs index e4358e78b6..99ec5de4af 100644 --- a/compiler/GHC/HsToCore/PmCheck/Ppr.hs +++ b/compiler/GHC/HsToCore/PmCheck/Ppr.hs @@ -20,6 +20,7 @@ import GHC.Core.ConLike import GHC.Core.DataCon import GHC.Builtin.Types import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad.Trans.RWS.CPS import GHC.Utils.Misc import GHC.Data.Maybe diff --git a/compiler/GHC/HsToCore/PmCheck/Types.hs b/compiler/GHC/HsToCore/PmCheck/Types.hs index 2d551fc1aa..f632c723da 100644 --- a/compiler/GHC/HsToCore/PmCheck/Types.hs +++ b/compiler/GHC/HsToCore/PmCheck/Types.hs @@ -55,6 +55,7 @@ import GHC.Types.Name import GHC.Core.DataCon import GHC.Core.ConLike import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.List.SetOps (unionLists) import GHC.Data.Maybe import GHC.Core.Type diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs index 1972b3bec0..5710521665 100644 --- a/compiler/GHC/HsToCore/Quote.hs +++ b/compiler/GHC/HsToCore/Quote.hs @@ -62,6 +62,7 @@ import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Unique import GHC.Types.Basic import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Bag import GHC.Driver.Session import GHC.Data.FastString diff --git a/compiler/GHC/HsToCore/Usage.hs b/compiler/GHC/HsToCore/Usage.hs index 12f4c950cb..ef42890302 100644 --- a/compiler/GHC/HsToCore/Usage.hs +++ b/compiler/GHC/HsToCore/Usage.hs @@ -25,6 +25,7 @@ import GHC.Utils.Misc import GHC.Types.Unique.Set import GHC.Types.Unique.FM import GHC.Utils.Fingerprint +import GHC.Utils.Panic import GHC.Data.Maybe import GHC.Driver.Finder diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs index 1b0face052..4f0da28586 100644 --- a/compiler/GHC/HsToCore/Utils.hs +++ b/compiler/GHC/HsToCore/Utils.hs @@ -77,9 +77,11 @@ import GHC.Unit.Module import GHC.Builtin.Names import GHC.Types.Name( isInternalName ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Utils.Misc import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Iface/Ext/Binary.hs b/compiler/GHC/Iface/Ext/Binary.hs index 4fc3b9a331..84ee0af60b 100644 --- a/compiler/GHC/Iface/Ext/Binary.hs +++ b/compiler/GHC/Iface/Ext/Binary.hs @@ -28,6 +28,7 @@ import GHC.Data.FastString ( FastString ) import GHC.Types.Name import GHC.Types.Name.Cache import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Builtin.Utils import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Unique.Supply ( takeUniqFromSupply ) diff --git a/compiler/GHC/Iface/Ext/Types.hs b/compiler/GHC/Iface/Ext/Types.hs index ce6b564b13..fe11bd094c 100644 --- a/compiler/GHC/Iface/Ext/Types.hs +++ b/compiler/GHC/Iface/Ext/Types.hs @@ -27,6 +27,7 @@ import GHC.Types.Avail import GHC.Types.Unique import qualified GHC.Utils.Outputable as O ( (<>) ) import GHC.Utils.Misc +import GHC.Utils.Panic import qualified Data.Array as A import qualified Data.Map as M diff --git a/compiler/GHC/Iface/Ext/Utils.hs b/compiler/GHC/Iface/Ext/Utils.hs index 102f6db656..d1b6db6fb7 100644 --- a/compiler/GHC/Iface/Ext/Utils.hs +++ b/compiler/GHC/Iface/Ext/Utils.hs @@ -10,6 +10,7 @@ import GHC.Prelude import GHC.Core.Map import GHC.Driver.Session ( DynFlags ) +import GHC.Driver.Ppr import GHC.Data.FastString ( FastString, mkFastString ) import GHC.Iface.Type import GHC.Core.Multiplicity @@ -54,7 +55,7 @@ generateReferencesMap = foldr (\ast m -> M.unionWith (++) (go ast) m) M.empty this = fmap (pure . (nodeSpan ast,)) $ sourcedNodeIdents $ sourcedNodeInfo ast renderHieType :: DynFlags -> HieTypeFix -> String -renderHieType dflags ht = renderWithStyle (initSDocContext dflags defaultUserStyle) (ppr $ hieTypeToIface ht) +renderHieType dflags ht = showSDoc dflags (ppr $ hieTypeToIface ht) resolveVisibility :: Type -> [Type] -> [(Bool,Type)] resolveVisibility kind ty_args diff --git a/compiler/GHC/Iface/Load.hs b/compiler/GHC/Iface/Load.hs index 119a0e23c4..b7ed66734e 100644 --- a/compiler/GHC/Iface/Load.hs +++ b/compiler/GHC/Iface/Load.hs @@ -42,6 +42,7 @@ import {-# SOURCE #-} GHC.IfaceToCore import GHC.Driver.Session import GHC.Driver.Backend +import GHC.Driver.Ppr import GHC.Iface.Syntax import GHC.Iface.Env import GHC.Driver.Types diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs index 59c93ef95c..3c33c0a3b6 100644 --- a/compiler/GHC/Iface/Make.hs +++ b/compiler/GHC/Iface/Make.hs @@ -49,6 +49,7 @@ import GHC.Hs import GHC.Driver.Types import GHC.Driver.Backend import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Types.Var.Env import GHC.Types.Var import GHC.Types.Name @@ -59,6 +60,7 @@ import GHC.Types.Name.Set import GHC.Unit.Module import GHC.Utils.Error import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Basic hiding ( SuccessFlag(..) ) import GHC.Utils.Misc hiding ( eqListBy ) import GHC.Data.FastString diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs index 4d680f4aca..7c8dc9722c 100644 --- a/compiler/GHC/Iface/Recomp.hs +++ b/compiler/GHC/Iface/Recomp.hs @@ -27,10 +27,12 @@ import GHC.Driver.Backend import GHC.Driver.Types import GHC.Driver.Finder import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Types.Name import GHC.Types.Name.Set import GHC.Unit.Module import GHC.Utils.Error +import GHC.Utils.Panic import GHC.Data.Graph.Directed import GHC.Types.SrcLoc import GHC.Utils.Outputable as Outputable diff --git a/compiler/GHC/Iface/Rename.hs b/compiler/GHC/Iface/Rename.hs index ff3604f597..ed8ac78761 100644 --- a/compiler/GHC/Iface/Rename.hs +++ b/compiler/GHC/Iface/Rename.hs @@ -34,6 +34,7 @@ import GHC.Types.Name import GHC.Tc.Utils.Monad import GHC.Utils.Misc import GHC.Utils.Fingerprint +import GHC.Utils.Panic import GHC.Types.Basic -- a bit vexing diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs index 5bc777e465..842bb2815a 100644 --- a/compiler/GHC/Iface/Syntax.hs +++ b/compiler/GHC/Iface/Syntax.hs @@ -60,20 +60,22 @@ import GHC.Types.Literal import GHC.Types.ForeignCall import GHC.Types.Annotations( AnnPayload, AnnTarget ) import GHC.Types.Basic -import GHC.Utils.Outputable as Outputable import GHC.Unit.Module import GHC.Types.SrcLoc -import GHC.Utils.Fingerprint -import GHC.Utils.Binary import GHC.Data.BooleanFormula ( BooleanFormula, pprBooleanFormula, isTrue ) import GHC.Types.Var( VarBndr(..), binderVar, tyVarSpecToBinders ) import GHC.Core.TyCon ( Role (..), Injectivity(..), tyConBndrVisArgFlag ) -import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith, debugIsOn, - seqList, zipWithEqual ) import GHC.Core.DataCon (SrcStrictness(..), SrcUnpackedness(..)) -import GHC.Utils.Lexeme (isLexSym) import GHC.Builtin.Types ( constraintKindTyConName ) +import GHC.Utils.Lexeme (isLexSym) +import GHC.Utils.Fingerprint +import GHC.Utils.Binary +import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic +import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith, debugIsOn, + seqList, zipWithEqual ) + import Control.Monad import System.IO.Unsafe import Control.DeepSeq diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs index 3c3fb4b488..f687f2951b 100644 --- a/compiler/GHC/Iface/Tidy.hs +++ b/compiler/GHC/Iface/Tidy.hs @@ -19,6 +19,7 @@ import GHC.Prelude import GHC.Tc.Types import GHC.Driver.Session import GHC.Driver.Backend +import GHC.Driver.Ppr import GHC.Core import GHC.Core.Unfold import GHC.Core.FVs @@ -59,6 +60,7 @@ import GHC.Data.Maybe import GHC.Types.Unique.Supply import GHC.Utils.Outputable import GHC.Utils.Misc( filterOut ) +import GHC.Utils.Panic import qualified GHC.Utils.Error as Err import Control.Monad diff --git a/compiler/GHC/Iface/Tidy/StaticPtrTable.hs b/compiler/GHC/Iface/Tidy/StaticPtrTable.hs index fe9c77d8a8..99320cd7ad 100644 --- a/compiler/GHC/Iface/Tidy/StaticPtrTable.hs +++ b/compiler/GHC/Iface/Tidy/StaticPtrTable.hs @@ -135,6 +135,7 @@ import GHC.Core.Make (mkStringExprFSWith) import GHC.Unit.Module import GHC.Types.Name import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Builtin.Names import GHC.Tc.Utils.Env (lookupGlobal) diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs index 2a152074f0..52d07f0fcb 100644 --- a/compiler/GHC/Iface/Type.hs +++ b/compiler/GHC/Iface/Type.hs @@ -91,6 +91,7 @@ import GHC.Utils.Binary import GHC.Utils.Outputable import GHC.Data.FastString import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Maybe( isJust ) import qualified Data.Semigroup as Semi diff --git a/compiler/GHC/Iface/UpdateIdInfos.hs b/compiler/GHC/Iface/UpdateIdInfos.hs index b4a6acfc67..9079bcae56 100644 --- a/compiler/GHC/Iface/UpdateIdInfos.hs +++ b/compiler/GHC/Iface/UpdateIdInfos.hs @@ -18,6 +18,7 @@ import GHC.Types.Name.Set import GHC.Types.Var import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic #include "HsVersions.h" diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs index 9f8ba03bc1..de32ae9e15 100644 --- a/compiler/GHC/IfaceToCore.hs +++ b/compiler/GHC/IfaceToCore.hs @@ -73,6 +73,7 @@ import GHC.Data.Maybe import GHC.Types.SrcLoc import GHC.Driver.Session import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Types.Basic hiding ( SuccessFlag(..) ) import GHC.Data.List.SetOps diff --git a/compiler/GHC/Llvm/Ppr.hs b/compiler/GHC/Llvm/Ppr.hs index 283a2993d6..5d32473796 100644 --- a/compiler/GHC/Llvm/Ppr.hs +++ b/compiler/GHC/Llvm/Ppr.hs @@ -41,6 +41,7 @@ import GHC.Llvm.Types import Data.Int import Data.List ( intersperse ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Data.FastString diff --git a/compiler/GHC/Llvm/Types.hs b/compiler/GHC/Llvm/Types.hs index 3fbff4837c..e628fe6b1b 100644 --- a/compiler/GHC/Llvm/Types.hs +++ b/compiler/GHC/Llvm/Types.hs @@ -18,6 +18,7 @@ import GHC.Platform import GHC.Driver.Session import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique -- from NCG diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index dfc7aec2ad..e6818fceb2 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -40,6 +40,7 @@ import GHC.Driver.Session import GHC.Utils.Error import GHC.Utils.Misc import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.Maybe import GHC.Data.Bag ( emptyBag, listToBag, unitBag ) import GHC.Utils.Monad diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 7395c53b80..dafc1e0fb0 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -92,21 +92,19 @@ import Data.ByteString (ByteString) import Data.Map (Map) import qualified Data.Map as Map --- compiler/utils +-- compiler import GHC.Data.Bag import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.StringBuffer import GHC.Data.FastString import GHC.Types.Unique.FM import GHC.Data.Maybe import GHC.Data.OrdList import GHC.Utils.Misc ( readRational, readHexRational ) - --- compiler/main import GHC.Utils.Error import GHC.Driver.Session as DynFlags --- compiler/basicTypes import GHC.Types.SrcLoc import GHC.Unit import GHC.Types.Basic ( InlineSpec(..), RuleMatchInfo(..), @@ -114,7 +112,6 @@ import GHC.Types.Basic ( InlineSpec(..), RuleMatchInfo(..), SourceText(..) ) import GHC.Hs.Doc --- compiler/parser import GHC.Parser.CharClass import GHC.Parser.Annotation diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 55e464fad1..c86d1f69c6 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -141,6 +141,7 @@ import Data.List import Data.Foldable import GHC.Driver.Session ( WarningFlag(..), DynFlags ) import GHC.Utils.Error ( Messages ) +import GHC.Utils.Panic import Control.Monad import Text.ParserCombinators.ReadP as ReadP diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 8c4e061e86..7dc36db037 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -57,6 +57,7 @@ import GHC.Hs import GHC.Types.SrcLoc import GHC.Driver.Session ( WarningFlag(..) ) import GHC.Utils.Outputable hiding ( (<>) ) +import GHC.Utils.Panic import GHC.Data.Bag import Data.Semigroup diff --git a/compiler/GHC/Platform/Reg.hs b/compiler/GHC/Platform/Reg.hs index c6679c8a70..1ecca9fe47 100644 --- a/compiler/GHC/Platform/Reg.hs +++ b/compiler/GHC/Platform/Reg.hs @@ -30,6 +30,7 @@ where import GHC.Prelude import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique import GHC.Platform.Reg.Class import Data.List (intersect) diff --git a/compiler/GHC/Plugins.hs b/compiler/GHC/Plugins.hs index 99fb30d7d2..87363c3a89 100644 --- a/compiler/GHC/Plugins.hs +++ b/compiler/GHC/Plugins.hs @@ -26,6 +26,7 @@ module GHC.Plugins , module GHC.Core.Rules , module GHC.Types.Annotations , module GHC.Driver.Session + , module GHC.Driver.Ppr , module GHC.Unit.State , module GHC.Unit.Module , module GHC.Core.Type @@ -46,6 +47,7 @@ module GHC.Plugins , module GHC.Serialized , module GHC.Types.SrcLoc , module GHC.Utils.Outputable + , module GHC.Utils.Panic , module GHC.Types.Unique.Supply , module GHC.Data.FastString , module GHC.Tc.Errors.Hole.FitTypes -- for hole-fit plugins @@ -111,6 +113,8 @@ import GHC.Utils.Misc import GHC.Serialized import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic +import GHC.Driver.Ppr import GHC.Types.Unique.Supply import GHC.Types.Unique ( Unique, Uniquable(..) ) import GHC.Data.FastString diff --git a/compiler/GHC/Rename/Bind.hs b/compiler/GHC/Rename/Bind.hs index da4213acee..9215ef26fc 100644 --- a/compiler/GHC/Rename/Bind.hs +++ b/compiler/GHC/Rename/Bind.hs @@ -58,6 +58,7 @@ import GHC.Data.Graph.Directed ( SCC(..) ) import GHC.Data.Bag import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique.Set import GHC.Data.Maybe ( orElse ) import GHC.Data.OrdList diff --git a/compiler/GHC/Rename/Env.hs b/compiler/GHC/Rename/Env.hs index 2b0a2e5ae9..13978bf4f1 100644 --- a/compiler/GHC/Rename/Env.hs +++ b/compiler/GHC/Rename/Env.hs @@ -75,6 +75,7 @@ import GHC.Types.SrcLoc as SrcLoc import GHC.Utils.Outputable as Outputable import GHC.Types.Unique.Set ( uniqSetAny ) import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.Maybe import GHC.Driver.Session import GHC.Data.FastString diff --git a/compiler/GHC/Rename/Expr.hs b/compiler/GHC/Rename/Expr.hs index 27d914e971..57e6aa68a4 100644 --- a/compiler/GHC/Rename/Expr.hs +++ b/compiler/GHC/Rename/Expr.hs @@ -58,6 +58,7 @@ import Data.Maybe (isJust, isNothing) import GHC.Utils.Misc import GHC.Data.List.SetOps ( removeDups ) import GHC.Utils.Error +import GHC.Utils.Panic import GHC.Utils.Outputable as Outputable import GHC.Types.SrcLoc import GHC.Data.FastString diff --git a/compiler/GHC/Rename/Fixity.hs b/compiler/GHC/Rename/Fixity.hs index eb9e59035b..89bc90e025 100644 --- a/compiler/GHC/Rename/Fixity.hs +++ b/compiler/GHC/Rename/Fixity.hs @@ -30,6 +30,7 @@ import GHC.Types.Basic ( Fixity(..), FixityDirection(..), minPrecedence, defaultFixity, SourceText(..) ) import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Maybe import Data.List import Data.Function ( on ) diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs index e7ba37c2b6..06dac08f4c 100644 --- a/compiler/GHC/Rename/HsType.hs +++ b/compiler/GHC/Rename/HsType.hs @@ -63,6 +63,7 @@ import GHC.Types.Basic ( compareFixity, funTyFixity, negateFixity , Fixity(..), FixityDirection(..), LexicalFixity(..) , TypeOrKind(..) ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Maybe import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs index 5e82ebdb7f..8920027e66 100644 --- a/compiler/GHC/Rename/Module.hs +++ b/compiler/GHC/Rename/Module.hs @@ -61,6 +61,7 @@ import GHC.Data.FastString import GHC.Types.SrcLoc as SrcLoc import GHC.Driver.Session import GHC.Utils.Misc ( debugIsOn, lengthExceeds, partitionWith ) +import GHC.Utils.Panic import GHC.Driver.Types ( HscEnv, hsc_dflags ) import GHC.Data.List.SetOps ( findDupsEq, removeDups, equivClasses ) import GHC.Data.Graph.Directed ( SCC, flattenSCC, flattenSCCs, Node(..) diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs index fb91f940ba..391c464fdb 100644 --- a/compiler/GHC/Rename/Names.hs +++ b/compiler/GHC/Rename/Names.hs @@ -35,6 +35,7 @@ module GHC.Rename.Names ( import GHC.Prelude import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Core.TyCo.Ppr import GHC.Hs import GHC.Tc.Utils.Env @@ -58,6 +59,7 @@ import GHC.Data.Maybe import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Basic ( TopLevelFlag(..), StringLiteral(..) ) import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.FastString.Env import GHC.Types.Id diff --git a/compiler/GHC/Rename/Pat.hs b/compiler/GHC/Rename/Pat.hs index 06a1036b5c..f0cd54358f 100644 --- a/compiler/GHC/Rename/Pat.hs +++ b/compiler/GHC/Rename/Pat.hs @@ -70,6 +70,7 @@ import GHC.Types.Basic import GHC.Utils.Misc import GHC.Data.List.SetOps( removeDups ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Types.Literal ( inCharRange ) import GHC.Builtin.Types ( nilDataCon ) diff --git a/compiler/GHC/Rename/Splice.hs b/compiler/GHC/Rename/Splice.hs index e49ff87db2..cbbe38070c 100644 --- a/compiler/GHC/Rename/Splice.hs +++ b/compiler/GHC/Rename/Splice.hs @@ -43,6 +43,7 @@ import GHC.Builtin.Names.TH ( liftName ) import GHC.Driver.Session import GHC.Data.FastString import GHC.Utils.Error ( dumpIfSet_dyn_printer, DumpFormat (..) ) +import GHC.Utils.Panic import GHC.Tc.Utils.Env ( tcMetaTy ) import GHC.Driver.Hooks import GHC.Builtin.Names.TH ( quoteExpName, quotePatName, quoteDecName, quoteTypeName diff --git a/compiler/GHC/Rename/Unbound.hs b/compiler/GHC/Rename/Unbound.hs index ec0084fa4c..f9c8dc4e22 100644 --- a/compiler/GHC/Rename/Unbound.hs +++ b/compiler/GHC/Rename/Unbound.hs @@ -31,6 +31,7 @@ import GHC.Builtin.Names ( mkUnboundName, isUnboundName, getUnique) import GHC.Utils.Misc import GHC.Data.Maybe import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import Data.List import Data.Function ( on ) diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs index 301aa4e081..64b86e1e94 100644 --- a/compiler/GHC/Rename/Utils.hs +++ b/compiler/GHC/Rename/Utils.hs @@ -49,6 +49,7 @@ import GHC.Types.Name.Env import GHC.Core.DataCon import GHC.Types.SrcLoc as SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Types.Basic ( TopLevelFlag(..) ) import GHC.Data.List.SetOps ( removeDups ) diff --git a/compiler/GHC/Runtime/Debugger.hs b/compiler/GHC/Runtime/Debugger.hs index 43aacc2085..9daa62d58d 100644 --- a/compiler/GHC/Runtime/Debugger.hs +++ b/compiler/GHC/Runtime/Debugger.hs @@ -37,6 +37,7 @@ import GHC.Core.Ppr.TyThing import GHC.Utils.Error import GHC.Utils.Monad import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Exception import Control.Monad diff --git a/compiler/GHC/Runtime/Eval.hs b/compiler/GHC/Runtime/Eval.hs index 6871073eea..2ee3143f76 100644 --- a/compiler/GHC/Runtime/Eval.hs +++ b/compiler/GHC/Runtime/Eval.hs @@ -80,6 +80,7 @@ import GHC.Types.Var.Env import GHC.ByteCode.Types import GHC.Runtime.Linker as Linker import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.LanguageExtensions import GHC.Types.Unique import GHC.Types.Unique.Supply diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs index b7e9a1b104..ea682702c6 100644 --- a/compiler/GHC/Runtime/Heap/Inspect.hs +++ b/compiler/GHC/Runtime/Heap/Inspect.hs @@ -57,7 +57,9 @@ import GHC.Types.Basic ( Boxity(..) ) import GHC.Builtin.Types.Prim import GHC.Builtin.Types import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable as Ppr +import GHC.Utils.Panic import GHC.Char import GHC.Exts.Heap import GHC.Runtime.Heap.Layout ( roundUpTo ) diff --git a/compiler/GHC/Runtime/Heap/Layout.hs b/compiler/GHC/Runtime/Heap/Layout.hs index cd09ad0163..7e4d5af136 100644 --- a/compiler/GHC/Runtime/Heap/Layout.hs +++ b/compiler/GHC/Runtime/Heap/Layout.hs @@ -48,12 +48,14 @@ import GHC.Prelude import GHC.Types.Basic( ConTagZ ) import GHC.Driver.Session -import GHC.Utils.Outputable import GHC.Platform import GHC.Platform.Profile import GHC.Data.FastString import GHC.StgToCmm.Types +import GHC.Utils.Outputable +import GHC.Utils.Panic + import Data.Word import Data.Bits import Data.ByteString (ByteString) diff --git a/compiler/GHC/Runtime/Interpreter.hs b/compiler/GHC/Runtime/Interpreter.hs index 561b4e2a6a..bcfd34ee15 100644 --- a/compiler/GHC/Runtime/Interpreter.hs +++ b/compiler/GHC/Runtime/Interpreter.hs @@ -70,7 +70,8 @@ import GHC.Types.Basic import GHC.Data.FastString import GHC.Utils.Misc import GHC.Runtime.Eval.Types(BreakInfo(..)) -import GHC.Utils.Outputable(brackets, ppr, showSDocUnqual) +import GHC.Utils.Outputable(brackets, ppr) +import GHC.Driver.Ppr (showSDoc) import GHC.Types.SrcLoc import GHC.Data.Maybe import GHC.Unit.Module @@ -413,7 +414,7 @@ handleSeqHValueStatus hsc_env eval_status = do | otherwise = Just (BreakInfo modl ix) sdocBpLoc = brackets . ppr . getSeqBpSpan putStrLn ("*** Ignoring breakpoint " ++ - (showSDocUnqual (hsc_dflags hsc_env) $ sdocBpLoc bp)) + (showSDoc (hsc_dflags hsc_env) $ sdocBpLoc bp)) -- resume the seq (:force) processing in the iserv process withForeignRef resume_ctxt_fhv $ \hval -> iservCmd hsc_env (ResumeSeq hval) >>= handleSeqHValueStatus hsc_env diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs index face7068d4..8c05c38c6c 100644 --- a/compiler/GHC/Runtime/Linker.hs +++ b/compiler/GHC/Runtime/Linker.hs @@ -50,6 +50,7 @@ import GHC.Unit.Module import GHC.Data.List.SetOps import GHC.Runtime.Linker.Types (DynLinker(..), PersistentLinkerState(..)) import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Types.Basic import GHC.Utils.Outputable import GHC.Utils.Panic diff --git a/compiler/GHC/Runtime/Loader.hs b/compiler/GHC/Runtime/Loader.hs index 5d286587ef..728b5ca84d 100644 --- a/compiler/GHC/Runtime/Loader.hs +++ b/compiler/GHC/Runtime/Loader.hs @@ -22,6 +22,7 @@ module GHC.Runtime.Loader ( import GHC.Prelude import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Runtime.Linker ( linkModule, getHValue ) import GHC.Runtime.Interpreter ( wormhole, withInterp ) diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs index a3479ca2b5..b5defa0ee2 100644 --- a/compiler/GHC/Settings/IO.hs +++ b/compiler/GHC/Settings/IO.hs @@ -17,7 +17,7 @@ import GHC.Settings.Config import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Settings import GHC.SysTools.BaseDir diff --git a/compiler/GHC/Stg/CSE.hs b/compiler/GHC/Stg/CSE.hs index abe0b6e482..61362053f5 100644 --- a/compiler/GHC/Stg/CSE.hs +++ b/compiler/GHC/Stg/CSE.hs @@ -96,6 +96,7 @@ import GHC.Core.DataCon import GHC.Types.Id import GHC.Stg.Syntax import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Basic (isWeakLoopBreaker) import GHC.Types.Var.Env import GHC.Core (AltCon(..)) diff --git a/compiler/GHC/Stg/DepAnal.hs b/compiler/GHC/Stg/DepAnal.hs index 2325cbab09..223ab0c5bb 100644 --- a/compiler/GHC/Stg/DepAnal.hs +++ b/compiler/GHC/Stg/DepAnal.hs @@ -9,6 +9,7 @@ import GHC.Types.Id import GHC.Types.Name (Name, nameIsLocalOrFrom) import GHC.Types.Name.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique.Set (nonDetEltsUniqSet) import GHC.Types.Var.Set import GHC.Unit.Module (Module) diff --git a/compiler/GHC/Stg/FVs.hs b/compiler/GHC/Stg/FVs.hs index 7fd7a3cae6..211a0cb315 100644 --- a/compiler/GHC/Stg/FVs.hs +++ b/compiler/GHC/Stg/FVs.hs @@ -50,6 +50,7 @@ import GHC.Types.Var.Set import GHC.Core ( Tickish(Breakpoint) ) import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Maybe ( mapMaybe ) diff --git a/compiler/GHC/Stg/Lift.hs b/compiler/GHC/Stg/Lift.hs index 6a75d20dd0..8abd6fc67d 100644 --- a/compiler/GHC/Stg/Lift.hs +++ b/compiler/GHC/Stg/Lift.hs @@ -29,6 +29,7 @@ import GHC.Stg.Syntax import GHC.Utils.Outputable import GHC.Types.Unique.Supply import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.Var.Set import Control.Monad ( when ) import Data.Maybe ( isNothing ) diff --git a/compiler/GHC/Stg/Lift/Analysis.hs b/compiler/GHC/Stg/Lift/Analysis.hs index 80883b9312..c0e4086f11 100644 --- a/compiler/GHC/Stg/Lift/Analysis.hs +++ b/compiler/GHC/Stg/Lift/Analysis.hs @@ -35,6 +35,7 @@ import qualified GHC.StgToCmm.ArgRep as StgToCmm.ArgRep import qualified GHC.StgToCmm.Closure as StgToCmm.Closure import qualified GHC.StgToCmm.Layout as StgToCmm.Layout import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Types.Var.Set diff --git a/compiler/GHC/Stg/Lift/Monad.hs b/compiler/GHC/Stg/Lift/Monad.hs index 04a3cbd470..4b99521066 100644 --- a/compiler/GHC/Stg/Lift/Monad.hs +++ b/compiler/GHC/Stg/Lift/Monad.hs @@ -37,6 +37,7 @@ import GHC.Stg.Syntax import GHC.Core.Utils import GHC.Types.Unique.Supply import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.Var.Env import GHC.Types.Var.Set import GHC.Core.Multiplicity diff --git a/compiler/GHC/Stg/Pipeline.hs b/compiler/GHC/Stg/Pipeline.hs index 64c7e74979..3891346dab 100644 --- a/compiler/GHC/Stg/Pipeline.hs +++ b/compiler/GHC/Stg/Pipeline.hs @@ -29,6 +29,7 @@ import GHC.Driver.Session import GHC.Utils.Error import GHC.Types.Unique.Supply import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad import Control.Monad.IO.Class import Control.Monad.Trans.State.Strict diff --git a/compiler/GHC/Stg/Subst.hs b/compiler/GHC/Stg/Subst.hs index ba3550b330..dce2859262 100644 --- a/compiler/GHC/Stg/Subst.hs +++ b/compiler/GHC/Stg/Subst.hs @@ -9,8 +9,12 @@ import GHC.Prelude import GHC.Types.Id import GHC.Types.Var.Env import Control.Monad.Trans.State.Strict + import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic + +import GHC.Driver.Ppr -- | A renaming substitution from 'Id's to 'Id's. Like 'RnEnv2', but not -- maintaining pairs of substitutions. Like 'GHC.Core.Subst.Subst', but diff --git a/compiler/GHC/Stg/Syntax.hs b/compiler/GHC/Stg/Syntax.hs index 6d5baf7173..dcc9847ed4 100644 --- a/compiler/GHC/Stg/Syntax.hs +++ b/compiler/GHC/Stg/Syntax.hs @@ -88,6 +88,7 @@ import GHC.Core.TyCon ( PrimRep(..), TyCon ) import GHC.Core.Type ( Type ) import GHC.Types.RepType ( typePrimRep1 ) import GHC.Utils.Misc +import GHC.Utils.Panic import Data.List.NonEmpty ( NonEmpty, toList ) diff --git a/compiler/GHC/Stg/Unarise.hs b/compiler/GHC/Stg/Unarise.hs index cea52d6cc3..85c022f799 100644 --- a/compiler/GHC/Stg/Unarise.hs +++ b/compiler/GHC/Stg/Unarise.hs @@ -214,6 +214,7 @@ import GHC.Core.Make (aBSENT_SUM_FIELD_ERROR_ID) import GHC.Types.Id.Make (voidPrimId, voidArgId) import GHC.Utils.Monad (mapAccumLM) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.RepType import GHC.Stg.Syntax import GHC.Core.Type diff --git a/compiler/GHC/StgToCmm.hs b/compiler/GHC/StgToCmm.hs index 1060043fbc..7447a1feeb 100644 --- a/compiler/GHC/StgToCmm.hs +++ b/compiler/GHC/StgToCmm.hs @@ -47,6 +47,7 @@ import GHC.Core.TyCon import GHC.Core.Multiplicity import GHC.Unit.Module import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Stream import GHC.Types.Basic import GHC.Types.Var.Set ( isEmptyDVarSet ) diff --git a/compiler/GHC/StgToCmm/Bind.hs b/compiler/GHC/StgToCmm/Bind.hs index 28f2050f35..dbb32aa0d5 100644 --- a/compiler/GHC/StgToCmm/Bind.hs +++ b/compiler/GHC/StgToCmm/Bind.hs @@ -50,8 +50,10 @@ import GHC.Utils.Misc import GHC.Types.Var.Set import GHC.Types.Basic import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Driver.Session +import GHC.Driver.Ppr import Control.Monad diff --git a/compiler/GHC/StgToCmm/CgUtils.hs b/compiler/GHC/StgToCmm/CgUtils.hs index 36ba21cb15..6722a4c288 100644 --- a/compiler/GHC/StgToCmm/CgUtils.hs +++ b/compiler/GHC/StgToCmm/CgUtils.hs @@ -26,7 +26,7 @@ import GHC.Cmm.Dataflow.Block import GHC.Cmm.Dataflow.Graph import GHC.Cmm.Utils import GHC.Cmm.CLabel -import GHC.Utils.Outputable +import GHC.Utils.Panic -- ----------------------------------------------------------------------------- -- Information about global registers diff --git a/compiler/GHC/StgToCmm/Closure.hs b/compiler/GHC/StgToCmm/Closure.hs index 4e0e5b8ea3..cc299e58ca 100644 --- a/compiler/GHC/StgToCmm/Closure.hs +++ b/compiler/GHC/StgToCmm/Closure.hs @@ -90,6 +90,7 @@ import GHC.Core.TyCon import GHC.Types.RepType import GHC.Types.Basic import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import Data.Coerce (coerce) diff --git a/compiler/GHC/StgToCmm/DataCon.hs b/compiler/GHC/StgToCmm/DataCon.hs index fdd4214b51..8e11bffad3 100644 --- a/compiler/GHC/StgToCmm/DataCon.hs +++ b/compiler/GHC/StgToCmm/DataCon.hs @@ -48,7 +48,7 @@ import GHC.Types.Name (isInternalName) import GHC.Types.RepType (countConRepArgs) import GHC.Types.Literal import GHC.Builtin.Utils -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Utils.Monad (mapMaybeM) diff --git a/compiler/GHC/StgToCmm/Env.hs b/compiler/GHC/StgToCmm/Env.hs index e1a1e3c184..3ad42fd19d 100644 --- a/compiler/GHC/StgToCmm/Env.hs +++ b/compiler/GHC/StgToCmm/Env.hs @@ -37,18 +37,22 @@ import GHC.Cmm.CLabel import GHC.Cmm.BlockId import GHC.Cmm.Expr import GHC.Cmm.Utils -import GHC.Driver.Session import GHC.Types.Id import GHC.Cmm.Graph import GHC.Types.Name -import GHC.Utils.Outputable import GHC.Stg.Syntax import GHC.Core.Type import GHC.Builtin.Types.Prim import GHC.Types.Unique.FM -import GHC.Utils.Misc import GHC.Types.Var.Env +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + +import GHC.Driver.Session + + ------------------------------------- -- Manipulating CgIdInfo ------------------------------------- diff --git a/compiler/GHC/StgToCmm/Expr.hs b/compiler/GHC/StgToCmm/Expr.hs index 61a4da571c..72f8941740 100644 --- a/compiler/GHC/StgToCmm/Expr.hs +++ b/compiler/GHC/StgToCmm/Expr.hs @@ -50,6 +50,7 @@ import GHC.Data.Maybe import GHC.Utils.Misc import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad ( unless, void ) import Control.Arrow ( first ) diff --git a/compiler/GHC/StgToCmm/Foreign.hs b/compiler/GHC/StgToCmm/Foreign.hs index ecab35714f..9c7866efae 100644 --- a/compiler/GHC/StgToCmm/Foreign.hs +++ b/compiler/GHC/StgToCmm/Foreign.hs @@ -44,7 +44,7 @@ import GHC.Cmm.CLabel import GHC.Runtime.Heap.Layout import GHC.Types.ForeignCall import GHC.Data.Maybe -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.Unique.Supply import GHC.Types.Basic diff --git a/compiler/GHC/StgToCmm/Layout.hs b/compiler/GHC/StgToCmm/Layout.hs index 9ba0b2cb6e..89175caf93 100644 --- a/compiler/GHC/StgToCmm/Layout.hs +++ b/compiler/GHC/StgToCmm/Layout.hs @@ -34,6 +34,9 @@ module GHC.StgToCmm.Layout ( import GHC.Prelude hiding ((<*>)) +import GHC.Driver.Session +import GHC.Driver.Ppr + import GHC.StgToCmm.Closure import GHC.StgToCmm.Env import GHC.StgToCmm.ArgRep -- notably: ( slowCallPattern ) @@ -52,7 +55,6 @@ import GHC.Stg.Syntax import GHC.Types.Id import GHC.Core.TyCon ( PrimRep(..), primRepSizeB ) import GHC.Types.Basic ( RepArity ) -import GHC.Driver.Session import GHC.Platform import GHC.Platform.Profile import GHC.Unit @@ -60,6 +62,7 @@ import GHC.Unit import GHC.Utils.Misc import Data.List import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import Control.Monad diff --git a/compiler/GHC/StgToCmm/Monad.hs b/compiler/GHC/StgToCmm/Monad.hs index 802f3ae54d..da68c578fb 100644 --- a/compiler/GHC/StgToCmm/Monad.hs +++ b/compiler/GHC/StgToCmm/Monad.hs @@ -82,6 +82,7 @@ import GHC.Types.Unique import GHC.Types.Unique.Supply import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import Control.Monad diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs index 374b5241fc..e967222d61 100644 --- a/compiler/GHC/StgToCmm/Prim.hs +++ b/compiler/GHC/StgToCmm/Prim.hs @@ -54,8 +54,8 @@ import GHC.Cmm.Utils import GHC.Builtin.PrimOps import GHC.Runtime.Heap.Layout import GHC.Data.FastString -import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import Data.Maybe import Data.Bits ((.&.), bit) diff --git a/compiler/GHC/StgToCmm/Prof.hs b/compiler/GHC/StgToCmm/Prof.hs index d58f20cfd1..355cc6a781 100644 --- a/compiler/GHC/StgToCmm/Prof.hs +++ b/compiler/GHC/StgToCmm/Prof.hs @@ -25,6 +25,9 @@ module GHC.StgToCmm.Prof ( import GHC.Prelude +import GHC.Driver.Session +import GHC.Driver.Ppr + import GHC.Platform import GHC.Platform.Profile import GHC.StgToCmm.Closure @@ -38,10 +41,10 @@ import GHC.Cmm.Utils import GHC.Cmm.CLabel import GHC.Types.CostCentre -import GHC.Driver.Session import GHC.Data.FastString import GHC.Unit.Module as Module import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.Monad import Data.Char (ord) diff --git a/compiler/GHC/StgToCmm/Ticky.hs b/compiler/GHC/StgToCmm/Ticky.hs index 733af2db96..b7f43665cd 100644 --- a/compiler/GHC/StgToCmm/Ticky.hs +++ b/compiler/GHC/StgToCmm/Ticky.hs @@ -122,9 +122,11 @@ import GHC.Types.Id import GHC.Types.Basic import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Driver.Session +import GHC.Driver.Ppr -- Turgid imports for showTypeCategory import GHC.Builtin.Names diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs index f1a68eeb28..5b9cd98b27 100644 --- a/compiler/GHC/StgToCmm/Utils.hs +++ b/compiler/GHC/StgToCmm/Utils.hs @@ -76,6 +76,7 @@ import GHC.Types.Unique.Supply (MonadUnique(..)) import GHC.Driver.Session import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.RepType import GHC.Types.CostCentre diff --git a/compiler/GHC/SysTools.hs b/compiler/GHC/SysTools.hs index b72c375545..e309b839f7 100644 --- a/compiler/GHC/SysTools.hs +++ b/compiler/GHC/SysTools.hs @@ -43,8 +43,8 @@ import GHC.Prelude import GHC.Settings.Utils import GHC.Unit -import GHC.Utils.Outputable import GHC.Utils.Error +import GHC.Utils.Panic import GHC.Platform import GHC.Driver.Session import GHC.Platform.Ways diff --git a/compiler/GHC/SysTools/ExtraObj.hs b/compiler/GHC/SysTools/ExtraObj.hs index 643ccdff18..c4247d8496 100644 --- a/compiler/GHC/SysTools/ExtraObj.hs +++ b/compiler/GHC/SysTools/ExtraObj.hs @@ -16,6 +16,7 @@ module GHC.SysTools.ExtraObj ( import GHC.Utils.Asm import GHC.Utils.Error import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Unit.State import GHC.Platform import GHC.Utils.Outputable as Outputable diff --git a/compiler/GHC/Tc/Deriv.hs b/compiler/GHC/Tc/Deriv.hs index 9fe439e42e..02c885ce51 100644 --- a/compiler/GHC/Tc/Deriv.hs +++ b/compiler/GHC/Tc/Deriv.hs @@ -61,6 +61,7 @@ import GHC.Builtin.Names import GHC.Types.SrcLoc import GHC.Utils.Misc import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Bag import GHC.Utils.FV as FV (fvVarList, unionFV, mkFVs) diff --git a/compiler/GHC/Tc/Deriv/Functor.hs b/compiler/GHC/Tc/Deriv/Functor.hs index c0566c0ede..324e51370c 100644 --- a/compiler/GHC/Tc/Deriv/Functor.hs +++ b/compiler/GHC/Tc/Deriv/Functor.hs @@ -30,7 +30,7 @@ import GHC.Data.Bag import GHC.Core.DataCon import GHC.Data.FastString import GHC.Hs -import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Builtin.Names import GHC.Types.Name.Reader import GHC.Types.SrcLoc diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs index 141acdc3a6..3585c9ad70 100644 --- a/compiler/GHC/Tc/Deriv/Generate.hs +++ b/compiler/GHC/Tc/Deriv/Generate.hs @@ -73,6 +73,7 @@ import GHC.Types.Var.Env import GHC.Utils.Misc import GHC.Types.Var import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Lexeme import GHC.Data.FastString import GHC.Data.Pair diff --git a/compiler/GHC/Tc/Deriv/Generics.hs b/compiler/GHC/Tc/Deriv/Generics.hs index ea9862d305..9821d040e3 100644 --- a/compiler/GHC/Tc/Deriv/Generics.hs +++ b/compiler/GHC/Tc/Deriv/Generics.hs @@ -49,6 +49,7 @@ import GHC.Data.Bag import GHC.Types.Var.Env import GHC.Types.Var.Set (elemVarSet) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Misc diff --git a/compiler/GHC/Tc/Deriv/Infer.hs b/compiler/GHC/Tc/Deriv/Infer.hs index 370c06f779..fb038b23fb 100644 --- a/compiler/GHC/Tc/Deriv/Infer.hs +++ b/compiler/GHC/Tc/Deriv/Infer.hs @@ -25,6 +25,7 @@ import GHC.Core.DataCon import GHC.Utils.Error import GHC.Tc.Utils.Instantiate import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Pair import GHC.Builtin.Names import GHC.Tc.Deriv.Utils diff --git a/compiler/GHC/Tc/Deriv/Utils.hs b/compiler/GHC/Tc/Deriv/Utils.hs index 471aedf690..e14d1ca7d8 100644 --- a/compiler/GHC/Tc/Deriv/Utils.hs +++ b/compiler/GHC/Tc/Deriv/Utils.hs @@ -38,6 +38,7 @@ import GHC.Iface.Load (loadInterfaceForName) import GHC.Unit.Module (getModule) import GHC.Types.Name import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Builtin.Names import GHC.Types.SrcLoc import GHC.Tc.Deriv.Generate diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs index 69d4654316..d597c95b72 100644 --- a/compiler/GHC/Tc/Errors.hs +++ b/compiler/GHC/Tc/Errors.hs @@ -58,8 +58,10 @@ import GHC.Core.ConLike ( ConLike(..)) import GHC.Utils.Misc import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.List.SetOps ( equivClasses ) import GHC.Data.Maybe import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Tc/Errors/Hole.hs b/compiler/GHC/Tc/Errors/Hole.hs index 25c7e8839a..600a84eb94 100644 --- a/compiler/GHC/Tc/Errors/Hole.hs +++ b/compiler/GHC/Tc/Errors/Hole.hs @@ -29,6 +29,7 @@ import GHC.Types.Var.Env import GHC.Data.Bag import GHC.Core.ConLike ( ConLike(..) ) import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Tc.Utils.Env (tcLookup) import GHC.Utils.Outputable import GHC.Driver.Session diff --git a/compiler/GHC/Tc/Gen/Arrow.hs b/compiler/GHC/Tc/Gen/Arrow.hs index 7fe507c1b2..1cbdcc005b 100644 --- a/compiler/GHC/Tc/Gen/Arrow.hs +++ b/compiler/GHC/Tc/Gen/Arrow.hs @@ -38,6 +38,7 @@ import GHC.Builtin.Types.Prim import GHC.Types.Basic( Arity ) import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import Control.Monad diff --git a/compiler/GHC/Tc/Gen/Bind.hs b/compiler/GHC/Tc/Gen/Bind.hs index 1944c61af5..7cf3126bbf 100644 --- a/compiler/GHC/Tc/Gen/Bind.hs +++ b/compiler/GHC/Tc/Gen/Bind.hs @@ -65,6 +65,7 @@ import GHC.Data.Maybe import GHC.Utils.Misc import GHC.Types.Basic import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Builtin.Names( ipClassName ) import GHC.Tc.Validity (checkValidType) import GHC.Types.Unique.FM diff --git a/compiler/GHC/Tc/Gen/Default.hs b/compiler/GHC/Tc/Gen/Default.hs index 9f31d7938a..1bd06ddc63 100644 --- a/compiler/GHC/Tc/Gen/Default.hs +++ b/compiler/GHC/Tc/Gen/Default.hs @@ -22,6 +22,7 @@ import GHC.Tc.Utils.TcType import GHC.Builtin.Names import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Tc/Gen/Export.hs b/compiler/GHC/Tc/Gen/Export.hs index 3aed54a802..fc0f993f03 100644 --- a/compiler/GHC/Tc/Gen/Export.hs +++ b/compiler/GHC/Tc/Gen/Export.hs @@ -30,6 +30,7 @@ import GHC.Core.TyCon import GHC.Types.SrcLoc as SrcLoc import GHC.Driver.Types import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.ConLike import GHC.Core.DataCon import GHC.Core.PatSyn diff --git a/compiler/GHC/Tc/Gen/Expr.hs b/compiler/GHC/Tc/Gen/Expr.hs index a6d2427f8d..f1030538e0 100644 --- a/compiler/GHC/Tc/Gen/Expr.hs +++ b/compiler/GHC/Tc/Gen/Expr.hs @@ -80,6 +80,7 @@ import GHC.Types.Var.Env ( emptyTidyEnv, mkInScopeSet ) import GHC.Data.List.SetOps import GHC.Data.Maybe import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Data.FastString import Control.Monad import GHC.Core.Class(classTyCon) diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs index 7a388d7263..040a246091 100644 --- a/compiler/GHC/Tc/Gen/Foreign.hs +++ b/compiler/GHC/Tc/Gen/Foreign.hs @@ -63,6 +63,7 @@ import GHC.Builtin.Names import GHC.Driver.Session import GHC.Driver.Backend import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Platform import GHC.Types.SrcLoc import GHC.Data.Bag diff --git a/compiler/GHC/Tc/Gen/HsType.hs b/compiler/GHC/Tc/Gen/HsType.hs index de8a85b37a..410844793f 100644 --- a/compiler/GHC/Tc/Gen/HsType.hs +++ b/compiler/GHC/Tc/Gen/HsType.hs @@ -114,6 +114,7 @@ import GHC.Types.Unique.Set import GHC.Utils.Misc import GHC.Types.Unique.Supply import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Builtin.Names hiding ( wildCardName ) import GHC.Driver.Session diff --git a/compiler/GHC/Tc/Gen/Match.hs b/compiler/GHC/Tc/Gen/Match.hs index ee428cbc42..b68e0db87c 100644 --- a/compiler/GHC/Tc/Gen/Match.hs +++ b/compiler/GHC/Tc/Gen/Match.hs @@ -60,6 +60,7 @@ import GHC.Core.TyCon import GHC.Builtin.Types.Prim import GHC.Tc.Types.Evidence import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Types.SrcLoc diff --git a/compiler/GHC/Tc/Gen/Pat.hs b/compiler/GHC/Tc/Gen/Pat.hs index e827e1215d..f01f67b39b 100644 --- a/compiler/GHC/Tc/Gen/Pat.hs +++ b/compiler/GHC/Tc/Gen/Pat.hs @@ -63,6 +63,7 @@ import GHC.Types.SrcLoc import GHC.Types.Var.Set import GHC.Utils.Misc import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import qualified GHC.LanguageExtensions as LangExt import Control.Arrow ( second ) import Control.Monad ( when ) diff --git a/compiler/GHC/Tc/Gen/Rule.hs b/compiler/GHC/Tc/Gen/Rule.hs index d5bca7a7c0..5ee65b6e05 100644 --- a/compiler/GHC/Tc/Gen/Rule.hs +++ b/compiler/GHC/Tc/Gen/Rule.hs @@ -34,6 +34,7 @@ import GHC.Types.Var.Set import GHC.Types.Basic ( RuleName ) import GHC.Types.SrcLoc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Bag diff --git a/compiler/GHC/Tc/Gen/Sig.hs b/compiler/GHC/Tc/Gen/Sig.hs index 35f6951ae1..a1d4277287 100644 --- a/compiler/GHC/Tc/Gen/Sig.hs +++ b/compiler/GHC/Tc/Gen/Sig.hs @@ -44,6 +44,7 @@ import GHC.Core.Multiplicity import GHC.Driver.Session import GHC.Driver.Backend +import GHC.Driver.Ppr import GHC.Types.Var ( TyVar, Specificity(..), tyVarKind, binderVars ) import GHC.Types.Id ( Id, idName, idType, idInlinePragma, setInlinePragma, mkLocalId ) import GHC.Builtin.Names( mkUnboundName ) @@ -52,6 +53,7 @@ import GHC.Unit.Module( getModule ) import GHC.Types.Name import GHC.Types.Name.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Utils.Misc( singleton ) import GHC.Data.Maybe( orElse ) diff --git a/compiler/GHC/Tc/Instance/Class.hs b/compiler/GHC/Tc/Instance/Class.hs index c5fc5bcdbe..278b63f03c 100644 --- a/compiler/GHC/Tc/Instance/Class.hs +++ b/compiler/GHC/Tc/Instance/Class.hs @@ -42,6 +42,7 @@ import GHC.Core.TyCon import GHC.Core.Class import GHC.Driver.Session import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc( splitAtList, fstOf3 ) import Data.Maybe diff --git a/compiler/GHC/Tc/Instance/FunDeps.hs b/compiler/GHC/Tc/Instance/FunDeps.hs index aba9031be6..c89a13dae8 100644 --- a/compiler/GHC/Tc/Instance/FunDeps.hs +++ b/compiler/GHC/Tc/Instance/FunDeps.hs @@ -38,11 +38,13 @@ import GHC.Types.Var.Set import GHC.Types.Var.Env import GHC.Core.TyCo.FVs import GHC.Core.TyCo.Ppr( pprWithExplicitKindsWhen ) -import GHC.Utils.FV +import GHC.Types.SrcLoc + import GHC.Utils.Outputable +import GHC.Utils.FV import GHC.Utils.Error( Validity(..), allValid ) -import GHC.Types.SrcLoc import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.Pair ( Pair(..) ) import Data.List ( nubBy ) diff --git a/compiler/GHC/Tc/Instance/Typeable.hs b/compiler/GHC/Tc/Instance/Typeable.hs index d49d820a45..42112b4a30 100644 --- a/compiler/GHC/Tc/Instance/Typeable.hs +++ b/compiler/GHC/Tc/Instance/Typeable.hs @@ -43,6 +43,7 @@ import GHC.Core.Map import GHC.Settings.Constants import GHC.Utils.Fingerprint(Fingerprint(..), fingerprintString, fingerprintFingerprints) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString ( FastString, mkFastString, fsLit ) import Control.Monad.Trans.State diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index 069fc1d3a6..d642a15147 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -121,6 +121,7 @@ import GHC.Types.SrcLoc import GHC.Driver.Types import GHC.Data.List.SetOps import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Core.ConLike import GHC.Core.DataCon import GHC.Core.Type diff --git a/compiler/GHC/Tc/Solver.hs b/compiler/GHC/Tc/Solver.hs index 8327b39e6d..96fe5cbca2 100644 --- a/compiler/GHC/Tc/Solver.hs +++ b/compiler/GHC/Tc/Solver.hs @@ -53,6 +53,7 @@ import GHC.Core.Type import GHC.Builtin.Types ( liftedRepTy, manyDataConTy ) import GHC.Core.Unify ( tcMatchTyKi ) import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.Var import GHC.Types.Var.Set import GHC.Types.Unique.Set diff --git a/compiler/GHC/Tc/Solver/Canonical.hs b/compiler/GHC/Tc/Solver/Canonical.hs index cf0255b6c5..ce663d9764 100644 --- a/compiler/GHC/Tc/Solver/Canonical.hs +++ b/compiler/GHC/Tc/Solver/Canonical.hs @@ -36,6 +36,7 @@ import GHC.Types.Var import GHC.Types.Var.Env( mkInScopeSet ) import GHC.Types.Var.Set( delVarSetList ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Driver.Session( DynFlags ) import GHC.Types.Name.Set import GHC.Types.Name.Reader diff --git a/compiler/GHC/Tc/Solver/Flatten.hs b/compiler/GHC/Tc/Solver/Flatten.hs index 00bf2579f0..2a4c7be1bb 100644 --- a/compiler/GHC/Tc/Solver/Flatten.hs +++ b/compiler/GHC/Tc/Solver/Flatten.hs @@ -28,6 +28,7 @@ import GHC.Types.Var import GHC.Types.Var.Set import GHC.Types.Var.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Tc.Solver.Monad as TcS import GHC.Types.Basic( SwapFlag(..) ) diff --git a/compiler/GHC/Tc/Solver/Interact.hs b/compiler/GHC/Tc/Solver/Interact.hs index 8d4dabc367..adc28d994a 100644 --- a/compiler/GHC/Tc/Solver/Interact.hs +++ b/compiler/GHC/Tc/Solver/Interact.hs @@ -37,6 +37,7 @@ import GHC.Core.Unify ( tcUnifyTyWithTFs, ruleMatchTyKiX ) import GHC.Tc.Types.Evidence import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Tc.Types import GHC.Tc.Types.Constraint diff --git a/compiler/GHC/Tc/Solver/Monad.hs b/compiler/GHC/Tc/Solver/Monad.hs index 14695fdd5a..49a3fb5c46 100644 --- a/compiler/GHC/Tc/Solver/Monad.hs +++ b/compiler/GHC/Tc/Solver/Monad.hs @@ -162,6 +162,7 @@ import GHC.Types.Var import GHC.Types.Var.Env import GHC.Types.Var.Set import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Bag as Bag import GHC.Types.Unique.Supply import GHC.Utils.Misc diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs index 0b8ec842b2..ccc23c3930 100644 --- a/compiler/GHC/Tc/TyCl.hs +++ b/compiler/GHC/Tc/TyCl.hs @@ -67,6 +67,7 @@ import GHC.Types.Name import GHC.Types.Name.Set import GHC.Types.Name.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.Maybe import GHC.Core.Unify import GHC.Utils.Misc diff --git a/compiler/GHC/Tc/TyCl/Build.hs b/compiler/GHC/Tc/TyCl/Build.hs index da17266c45..93f5eedb50 100644 --- a/compiler/GHC/Tc/TyCl/Build.hs +++ b/compiler/GHC/Tc/TyCl/Build.hs @@ -43,6 +43,7 @@ import GHC.Tc.Utils.Monad import GHC.Types.Unique.Supply import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs diff --git a/compiler/GHC/Tc/TyCl/Class.hs b/compiler/GHC/Tc/TyCl/Class.hs index 4430e0e682..5fa26c2c57 100644 --- a/compiler/GHC/Tc/TyCl/Class.hs +++ b/compiler/GHC/Tc/TyCl/Class.hs @@ -59,6 +59,7 @@ import GHC.Types.Name.Set import GHC.Types.Var import GHC.Types.Var.Env import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Core.TyCon import GHC.Data.Maybe diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs index fbcb2e0363..074fb22329 100644 --- a/compiler/GHC/Tc/TyCl/Instance.hs +++ b/compiler/GHC/Tc/TyCl/Instance.hs @@ -65,6 +65,7 @@ import GHC.Types.Var.Set import GHC.Data.Bag import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Error import GHC.Data.FastString import GHC.Types.Id @@ -72,6 +73,7 @@ import GHC.Data.List.SetOps import GHC.Types.Name import GHC.Types.Name.Set import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Utils.Misc import GHC.Data.BooleanFormula ( isUnsatisfied, pprBooleanFormulaNice ) diff --git a/compiler/GHC/Tc/TyCl/Utils.hs b/compiler/GHC/Tc/TyCl/Utils.hs index a9557a2351..699e601777 100644 --- a/compiler/GHC/Tc/TyCl/Utils.hs +++ b/compiler/GHC/Tc/TyCl/Utils.hs @@ -61,6 +61,7 @@ import GHC.Types.Basic import GHC.Types.SrcLoc import GHC.Types.Unique ( mkBuiltinUnique ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Data.Maybe import GHC.Data.Bag diff --git a/compiler/GHC/Tc/Types.hs b/compiler/GHC/Tc/Types.hs index 611d89954b..b782dceee8 100644 --- a/compiler/GHC/Tc/Types.hs +++ b/compiler/GHC/Tc/Types.hs @@ -127,6 +127,7 @@ import GHC.Utils.Outputable import GHC.Data.List.SetOps import GHC.Utils.Fingerprint import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Builtin.Names ( isUnboundName ) import GHC.Types.CostCentre.State diff --git a/compiler/GHC/Tc/Types/Constraint.hs b/compiler/GHC/Tc/Types/Constraint.hs index 45266c831e..fd2d1f00ce 100644 --- a/compiler/GHC/Tc/Types/Constraint.hs +++ b/compiler/GHC/Tc/Types/Constraint.hs @@ -97,6 +97,7 @@ import GHC.Utils.Outputable import GHC.Types.SrcLoc import GHC.Data.Bag import GHC.Utils.Misc +import GHC.Utils.Panic import Control.Monad ( msum ) diff --git a/compiler/GHC/Tc/Types/Evidence.hs b/compiler/GHC/Tc/Types/Evidence.hs index b9d460b8ec..985cbae01b 100644 --- a/compiler/GHC/Tc/Types/Evidence.hs +++ b/compiler/GHC/Tc/Types/Evidence.hs @@ -82,9 +82,11 @@ import GHC.Core.Class ( classSCSelId ) import GHC.Core.FVs ( exprSomeFreeVars ) import GHC.Utils.Misc +import GHC.Utils.Panic +import GHC.Utils.Outputable + import GHC.Data.Bag import qualified Data.Data as Data -import GHC.Utils.Outputable import GHC.Types.SrcLoc import Data.IORef( IORef ) import GHC.Types.Unique.Set diff --git a/compiler/GHC/Tc/Types/Origin.hs b/compiler/GHC/Tc/Types/Origin.hs index cf43905ffb..b2fdefa4cd 100644 --- a/compiler/GHC/Tc/Types/Origin.hs +++ b/compiler/GHC/Tc/Types/Origin.hs @@ -28,7 +28,6 @@ import GHC.Tc.Utils.TcType import GHC.Hs -import GHC.Types.Id import GHC.Core.DataCon import GHC.Core.ConLike import GHC.Core.TyCon @@ -37,13 +36,17 @@ import GHC.Core.PatSyn import GHC.Core.Multiplicity ( scaledThing ) import GHC.Unit.Module +import GHC.Types.Id import GHC.Types.Name import GHC.Types.Name.Reader - +import GHC.Types.Basic import GHC.Types.SrcLoc + import GHC.Data.FastString + import GHC.Utils.Outputable -import GHC.Types.Basic +import GHC.Utils.Panic +import GHC.Driver.Ppr {- ********************************************************************* * * diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs index f90c6923c8..bddda199a8 100644 --- a/compiler/GHC/Tc/Utils/Backpack.hs +++ b/compiler/GHC/Tc/Utils/Backpack.hs @@ -24,6 +24,7 @@ import GHC.Types.Basic (defaultFixity, TypeOrKind(..)) import GHC.Unit.State import GHC.Tc.Gen.Export import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Hs import GHC.Types.Name.Reader import GHC.Tc.Utils.Monad @@ -49,6 +50,7 @@ import GHC.Types.Avail import GHC.Types.SrcLoc import GHC.Driver.Types import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Core.Type import GHC.Core.Multiplicity import GHC.Data.FastString diff --git a/compiler/GHC/Tc/Utils/Env.hs b/compiler/GHC/Tc/Utils/Env.hs index 76ebb79e1e..0b92d7b3d2 100644 --- a/compiler/GHC/Tc/Utils/Env.hs +++ b/compiler/GHC/Tc/Utils/Env.hs @@ -107,6 +107,7 @@ import GHC.Types.SrcLoc import GHC.Types.Basic hiding( SuccessFlag(..) ) import GHC.Unit.Module import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Encoding import GHC.Data.FastString import GHC.Data.Bag diff --git a/compiler/GHC/Tc/Utils/Instantiate.hs b/compiler/GHC/Tc/Utils/Instantiate.hs index 385cd634e8..8a9c791da3 100644 --- a/compiler/GHC/Tc/Utils/Instantiate.hs +++ b/compiler/GHC/Tc/Utils/Instantiate.hs @@ -76,6 +76,7 @@ import GHC.Builtin.Names import GHC.Types.SrcLoc as SrcLoc import GHC.Driver.Session import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Utils.Outputable import GHC.Types.Basic ( TypeOrKind(..) ) import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs index 18cdfdf935..47e1ab8a9d 100644 --- a/compiler/GHC/Tc/Utils/Monad.hs +++ b/compiler/GHC/Tc/Utils/Monad.hs @@ -149,6 +149,8 @@ module GHC.Tc.Utils.Monad( import GHC.Prelude +import GHC.Driver.Ppr + import GHC.Tc.Types -- Re-export all import GHC.Data.IOEnv -- Re-export all import GHC.Tc.Types.Constraint diff --git a/compiler/GHC/Tc/Utils/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs index e8ae500075..0995eb51e9 100644 --- a/compiler/GHC/Tc/Utils/TcMType.hs +++ b/compiler/GHC/Tc/Utils/TcMType.hs @@ -120,11 +120,13 @@ import GHC.Types.Var.Env import GHC.Types.Name.Env import GHC.Utils.Misc import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.Bag import GHC.Data.Pair import GHC.Types.Unique.Set import GHC.Driver.Session +import GHC.Driver.Ppr import qualified GHC.LanguageExtensions as LangExt import GHC.Types.Basic ( TypeOrKind(..) ) diff --git a/compiler/GHC/Tc/Utils/TcType.hs b/compiler/GHC/Tc/Utils/TcType.hs index 6b0df55f46..357858cf9a 100644 --- a/compiler/GHC/Tc/Utils/TcType.hs +++ b/compiler/GHC/Tc/Utils/TcType.hs @@ -226,6 +226,7 @@ import GHC.Utils.Misc import GHC.Data.Maybe import GHC.Data.List.SetOps ( getNth, findDupsEq ) import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Utils.Error( Validity(..), MsgDoc, isValid ) import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/Tc/Utils/Unify.hs b/compiler/GHC/Tc/Utils/Unify.hs index 2aa47748cb..6a83348b2a 100644 --- a/compiler/GHC/Tc/Utils/Unify.hs +++ b/compiler/GHC/Tc/Utils/Unify.hs @@ -71,6 +71,7 @@ import GHC.Data.Bag import GHC.Utils.Misc import qualified GHC.LanguageExtensions as LangExt import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import Control.Monad import Control.Arrow ( second ) diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs index 63a46dda14..42a89cf633 100644 --- a/compiler/GHC/Tc/Utils/Zonk.hs +++ b/compiler/GHC/Tc/Utils/Zonk.hs @@ -79,6 +79,7 @@ import GHC.Types.SrcLoc import GHC.Data.Bag import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.Unique.FM import GHC.Core.Multiplicity import GHC.Core diff --git a/compiler/GHC/Tc/Validity.hs b/compiler/GHC/Tc/Validity.hs index 080132c080..b7a9876144 100644 --- a/compiler/GHC/Tc/Validity.hs +++ b/compiler/GHC/Tc/Validity.hs @@ -66,6 +66,7 @@ import GHC.Utils.Misc import GHC.Data.List.SetOps import GHC.Types.SrcLoc import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import GHC.Types.Unique ( mkAlphaTyVarUnique ) import GHC.Data.Bag ( emptyBag ) import qualified GHC.LanguageExtensions as LangExt diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index eebb0c7974..d6ecba4149 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -50,6 +50,7 @@ import GHC.Utils.Lexeme import GHC.Utils.Misc import GHC.Data.FastString import GHC.Utils.Outputable as Outputable +import GHC.Utils.Panic import qualified Data.ByteString as BS import Control.Monad( unless, ap ) diff --git a/compiler/GHC/Types/Avail.hs b/compiler/GHC/Types/Avail.hs index bee35d9395..adc3ffa391 100644 --- a/compiler/GHC/Types/Avail.hs +++ b/compiler/GHC/Types/Avail.hs @@ -38,6 +38,7 @@ import GHC.Types.FieldLabel import GHC.Utils.Binary import GHC.Data.List.SetOps import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Misc import Data.Data ( Data ) diff --git a/compiler/GHC/Types/Basic.hs b/compiler/GHC/Types/Basic.hs index a0693b3f86..e89196c1a6 100644 --- a/compiler/GHC/Types/Basic.hs +++ b/compiler/GHC/Types/Basic.hs @@ -115,6 +115,7 @@ import GHC.Prelude import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc ( Located,unLoc ) import Data.Data hiding (Fixity, Prefix, Infix) import Data.Function (on) diff --git a/compiler/GHC/Types/Demand.hs b/compiler/GHC/Types/Demand.hs index 51acdf3d8e..ef22c98315 100644 --- a/compiler/GHC/Types/Demand.hs +++ b/compiler/GHC/Types/Demand.hs @@ -59,13 +59,10 @@ module GHC.Types.Demand ( import GHC.Prelude -import GHC.Utils.Outputable import GHC.Types.Var ( Var ) import GHC.Types.Var.Env import GHC.Types.Unique.FM -import GHC.Utils.Misc import GHC.Types.Basic -import GHC.Utils.Binary import GHC.Data.Maybe ( orElse ) import GHC.Core.Type ( Type ) @@ -73,6 +70,13 @@ import GHC.Core.TyCon ( isNewTyCon, isClassTyCon ) import GHC.Core.DataCon ( splitDataProductType_maybe ) import GHC.Core.Multiplicity ( scaledThing ) +import GHC.Utils.Binary +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + +import GHC.Driver.Ppr + {- ************************************************************************ * * diff --git a/compiler/GHC/Types/ForeignCall.hs b/compiler/GHC/Types/ForeignCall.hs index b6f0e0b21f..e811604efb 100644 --- a/compiler/GHC/Types/ForeignCall.hs +++ b/compiler/GHC/Types/ForeignCall.hs @@ -23,6 +23,7 @@ import GHC.Prelude import GHC.Data.FastString import GHC.Utils.Binary import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Unit.Module import GHC.Types.Basic ( SourceText, pprWithSourceText ) diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs index 81b7cf20d2..cbf566a5fe 100644 --- a/compiler/GHC/Types/Id.hs +++ b/compiler/GHC/Types/Id.hs @@ -152,13 +152,17 @@ import {-# SOURCE #-} GHC.Builtin.PrimOps (PrimOp) import GHC.Types.ForeignCall import GHC.Data.Maybe import GHC.Types.SrcLoc -import GHC.Utils.Outputable import GHC.Types.Unique import GHC.Types.Unique.Supply import GHC.Data.FastString -import GHC.Utils.Misc import GHC.Core.Multiplicity +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + +import GHC.Driver.Ppr + -- infixl so you can say (id `set` a `set` b) infixl 1 `setIdUnfolding`, `setIdArity`, diff --git a/compiler/GHC/Types/Id/Info.hs b/compiler/GHC/Types/Id/Info.hs index f67f581b74..028a277a42 100644 --- a/compiler/GHC/Types/Id/Info.hs +++ b/compiler/GHC/Types/Id/Info.hs @@ -104,11 +104,13 @@ import GHC.Core.TyCon import GHC.Core.PatSyn import GHC.Core.Type import GHC.Types.ForeignCall -import GHC.Utils.Outputable import GHC.Unit.Module import GHC.Types.Demand import GHC.Types.Cpr + import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.Word import Data.Bits diff --git a/compiler/GHC/Types/Id/Make.hs b/compiler/GHC/Types/Id/Make.hs index 6d49479807..bd25be0ce0 100644 --- a/compiler/GHC/Types/Id/Make.hs +++ b/compiler/GHC/Types/Id/Make.hs @@ -74,7 +74,9 @@ import GHC.Builtin.Names import GHC.Types.Basic hiding ( SuccessFlag(..) ) import GHC.Utils.Misc import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import GHC.Data.List.SetOps import GHC.Types.Var (VarBndr(Bndr)) diff --git a/compiler/GHC/Types/Literal.hs b/compiler/GHC/Types/Literal.hs index 93b8bd9b9d..2c5471c52b 100644 --- a/compiler/GHC/Types/Literal.hs +++ b/compiler/GHC/Types/Literal.hs @@ -65,6 +65,7 @@ import GHC.Settings.Constants import GHC.Platform import GHC.Types.Unique.FM import GHC.Utils.Misc +import GHC.Utils.Panic import Data.ByteString (ByteString) import Data.Int diff --git a/compiler/GHC/Types/Name.hs b/compiler/GHC/Types/Name.hs index 9d74dee606..4a03a5bfc9 100644 --- a/compiler/GHC/Types/Name.hs +++ b/compiler/GHC/Types/Name.hs @@ -94,6 +94,7 @@ import GHC.Data.Maybe import GHC.Utils.Binary import GHC.Data.FastString import GHC.Utils.Outputable +import GHC.Utils.Panic import Control.DeepSeq import Data.Data diff --git a/compiler/GHC/Types/Name/Cache.hs b/compiler/GHC/Types/Name/Cache.hs index 0506c5747c..b33e5c2ddf 100644 --- a/compiler/GHC/Types/Name/Cache.hs +++ b/compiler/GHC/Types/Name/Cache.hs @@ -16,9 +16,11 @@ import GHC.Unit.Module import GHC.Types.Name import GHC.Types.Unique.Supply import GHC.Builtin.Types +import GHC.Builtin.Names + import GHC.Utils.Misc import GHC.Utils.Outputable -import GHC.Builtin.Names +import GHC.Utils.Panic #include "HsVersions.h" diff --git a/compiler/GHC/Types/Name/Reader.hs b/compiler/GHC/Types/Name/Reader.hs index 32b59eaa30..826137f76f 100644 --- a/compiler/GHC/Types/Name/Reader.hs +++ b/compiler/GHC/Types/Name/Reader.hs @@ -85,6 +85,7 @@ import GHC.Types.Unique import GHC.Types.Unique.FM import GHC.Types.Unique.Set import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Types.Name.Env import Data.Data diff --git a/compiler/GHC/Types/Name/Shape.hs b/compiler/GHC/Types/Name/Shape.hs index d4ad316887..96b7073cce 100644 --- a/compiler/GHC/Types/Name/Shape.hs +++ b/compiler/GHC/Types/Name/Shape.hs @@ -26,6 +26,7 @@ import GHC.Types.Name import GHC.Types.Name.Env import GHC.Tc.Utils.Monad import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Iface.Env import Control.Monad diff --git a/compiler/GHC/Types/RepType.hs b/compiler/GHC/Types/RepType.hs index 6ab4387f38..98ba865a95 100644 --- a/compiler/GHC/Types/RepType.hs +++ b/compiler/GHC/Types/RepType.hs @@ -27,16 +27,18 @@ import GHC.Prelude import GHC.Types.Basic (Arity, RepArity) import GHC.Core.DataCon -import GHC.Utils.Outputable import GHC.Builtin.Names import GHC.Core.Coercion import GHC.Core.TyCon import GHC.Core.TyCo.Rep import GHC.Core.Type -import GHC.Utils.Misc import GHC.Builtin.Types.Prim import {-# SOURCE #-} GHC.Builtin.Types ( anyTypeOfKind ) +import GHC.Utils.Misc +import GHC.Utils.Outputable +import GHC.Utils.Panic + import Data.List (sort) import qualified Data.IntSet as IS diff --git a/compiler/GHC/Types/SrcLoc.hs b/compiler/GHC/Types/SrcLoc.hs index 2ac2a13b04..46a362026f 100644 --- a/compiler/GHC/Types/SrcLoc.hs +++ b/compiler/GHC/Types/SrcLoc.hs @@ -120,6 +120,7 @@ import GHC.Prelude import GHC.Utils.Misc import GHC.Utils.Json import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Data.FastString import Control.DeepSeq diff --git a/compiler/GHC/Types/Unique.hs b/compiler/GHC/Types/Unique.hs index 36d85ff9f2..c97f7a9553 100644 --- a/compiler/GHC/Types/Unique.hs +++ b/compiler/GHC/Types/Unique.hs @@ -81,6 +81,7 @@ import GHC.Types.Basic import GHC.Data.FastString import GHC.Utils.Outputable import GHC.Utils.Misc +import GHC.Utils.Panic -- just for implementing a fast [0,61) -> Char function import GHC.Exts (indexCharOffAddr#, Char(..), Int(..)) diff --git a/compiler/GHC/Types/Var.hs b/compiler/GHC/Types/Var.hs index 058b6ffc03..b5892a70da 100644 --- a/compiler/GHC/Types/Var.hs +++ b/compiler/GHC/Types/Var.hs @@ -109,6 +109,7 @@ import GHC.Types.Unique ( Uniquable, Unique, getKey, getUnique import GHC.Utils.Misc import GHC.Utils.Binary import GHC.Utils.Outputable +import GHC.Utils.Panic import Data.Data diff --git a/compiler/GHC/Types/Var/Env.hs b/compiler/GHC/Types/Var/Env.hs index 47cdc8734b..ed58c413f4 100644 --- a/compiler/GHC/Types/Var/Env.hs +++ b/compiler/GHC/Types/Var/Env.hs @@ -86,6 +86,7 @@ import GHC.Types.Unique.FM import GHC.Types.Unique.DFM import GHC.Types.Unique import GHC.Utils.Misc +import GHC.Utils.Panic import GHC.Data.Maybe import GHC.Utils.Outputable diff --git a/compiler/GHC/Unit/State.hs-boot b/compiler/GHC/Unit/State.hs-boot index f03c12fac3..a3bc8fa7d6 100644 --- a/compiler/GHC/Unit/State.hs-boot +++ b/compiler/GHC/Unit/State.hs-boot @@ -1,6 +1,5 @@ module GHC.Unit.State where -import GHC.Data.FastString import {-# SOURCE #-} GHC.Utils.Outputable import {-# SOURCE #-} GHC.Unit.Types (IndefUnitId, UnitId) @@ -8,6 +7,5 @@ data UnitState data UnitDatabase unit emptyUnitState :: UnitState -mkIndefUnitId :: UnitState -> FastString -> IndefUnitId pprUnitIdForUser :: UnitState -> UnitId -> SDoc updateIndefUnitId :: UnitState -> IndefUnitId -> IndefUnitId diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs index 4c72c052d7..e3d3cde2f7 100644 --- a/compiler/GHC/Utils/Error.hs +++ b/compiler/GHC/Utils/Error.hs @@ -73,6 +73,7 @@ import GHC.Utils.Panic import qualified GHC.Utils.Ppr.Colour as Col import GHC.Types.SrcLoc as SrcLoc import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString (unpackFS) import GHC.Data.StringBuffer (atLine, hGetStringBuffer, len, lexemeToString) import GHC.Utils.Json diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs index 50ac5dc9e8..8fba20a3c3 100644 --- a/compiler/GHC/Utils/Misc.hs +++ b/compiler/GHC/Utils/Misc.hs @@ -172,7 +172,8 @@ import qualified Data.Set as Set import Data.Time #if defined(DEBUG) -import {-# SOURCE #-} GHC.Utils.Outputable ( warnPprTrace, text ) +import {-# SOURCE #-} GHC.Utils.Outputable ( text ) +import {-# SOURCE #-} GHC.Driver.Ppr ( warnPprTrace ) #endif infixr 9 `thenCmp` diff --git a/compiler/GHC/Utils/Outputable.hs b/compiler/GHC/Utils/Outputable.hs index b3d1772076..e83f0af927 100644 --- a/compiler/GHC/Utils/Outputable.hs +++ b/compiler/GHC/Utils/Outputable.hs @@ -16,7 +16,7 @@ module GHC.Utils.Outputable ( Outputable(..), OutputableBndr(..), -- * Pretty printing combinators - SDoc, runSDoc, initSDocContext, + SDoc, runSDoc, docToSDoc, interppSP, interpp'SP, pprQuotedList, pprWithCommas, quotedListWithOr, quotedListWithNor, @@ -43,12 +43,10 @@ module GHC.Utils.Outputable ( coloured, keyword, -- * Converting 'SDoc' into strings and outputting it - printSDoc, printSDocLn, printForUser, - printForC, bufLeftRenderSDoc, + printSDoc, printSDocLn, + bufLeftRenderSDoc, pprCode, mkCodeStyle, - showSDoc, showSDocUnsafe, showSDocOneLine, - showSDocForUser, showSDocDebug, showSDocDump, showSDocDumpOneLine, - showSDocUnqual, showPpr, + showSDocOneLine, renderWithStyle, pprInfixVar, pprPrefixVar, @@ -84,20 +82,11 @@ module GHC.Utils.Outputable ( ifPprDebug, whenPprDebug, getPprDebug, - -- * Error handling and debugging utilities - pprPanic, pprSorry, assertPprPanic, pprPgmError, - pprTrace, pprTraceDebug, pprTraceWith, pprTraceIt, warnPprTrace, - pprSTrace, pprTraceException, pprTraceM, pprTraceWithFlags, - trace, pgmError, panic, sorry, assertPanic, - pprDebugAndThen, callStackDoc, ) where import GHC.Prelude -import {-# SOURCE #-} GHC.Driver.Session - ( DynFlags, hasPprDebug, hasNoDebugOutput - , unsafeGlobalDynFlags, initSDocContext - ) +import {-# SOURCE #-} GHC.Driver.Session ( DynFlags ) import {-# SOURCE #-} GHC.Unit.Types ( Unit, Module, moduleName ) import {-# SOURCE #-} GHC.Unit.Module.Name( ModuleName ) import {-# SOURCE #-} GHC.Types.Name.Occurrence( OccName ) @@ -105,10 +94,8 @@ import {-# SOURCE #-} GHC.Types.Name.Occurrence( OccName ) import GHC.Utils.BufHandle (BufHandle) import GHC.Data.FastString import qualified GHC.Utils.Ppr as Pretty -import GHC.Utils.Misc import qualified GHC.Utils.Ppr.Colour as Col import GHC.Utils.Ppr ( Doc, Mode(..) ) -import GHC.Utils.Panic import GHC.Serialized import GHC.LanguageExtensions (Extension) @@ -133,8 +120,6 @@ import qualified Data.List.NonEmpty as NEL import GHC.Fingerprint import GHC.Show ( showMultiLineString ) -import GHC.Stack ( callStack, prettyCallStack ) -import Control.Monad.IO.Class import GHC.Utils.Exception {- @@ -493,18 +478,6 @@ printSDocLn :: SDocContext -> Mode -> Handle -> SDoc -> IO () printSDocLn ctx mode handle doc = printSDoc ctx mode handle (doc $$ text "") -printForUser :: DynFlags -> Handle -> PrintUnqualified -> Depth -> SDoc -> IO () -printForUser dflags handle unqual depth doc - = printSDocLn ctx PageMode handle doc - where ctx = initSDocContext dflags (mkUserStyle unqual depth) - --- | Like 'printSDocLn' but specialized with 'LeftMode' and --- @'PprCode' 'CStyle'@. This is typically used to output C-- code. -printForC :: DynFlags -> Handle -> SDoc -> IO () -printForC dflags handle doc = - printSDocLn ctx LeftMode handle doc - where ctx = initSDocContext dflags (PprCode CStyle) - -- | An efficient variant of 'printSDoc' specialized for 'LeftMode' that -- outputs to a 'BufHandle'. bufLeftRenderSDoc :: SDocContext -> BufHandle -> SDoc -> IO () @@ -517,39 +490,6 @@ pprCode cs d = withPprStyle (PprCode cs) d mkCodeStyle :: CodeStyle -> PprStyle mkCodeStyle = PprCode --- Can't make SDoc an instance of Show because SDoc is just a function type --- However, Doc *is* an instance of Show --- showSDoc just blasts it out as a string -showSDoc :: DynFlags -> SDoc -> String -showSDoc dflags sdoc = renderWithStyle (initSDocContext dflags defaultUserStyle) sdoc - --- showSDocUnsafe is unsafe, because `unsafeGlobalDynFlags` might not be --- initialised yet. -showSDocUnsafe :: SDoc -> String -showSDocUnsafe sdoc = showSDoc unsafeGlobalDynFlags sdoc - -showPpr :: Outputable a => DynFlags -> a -> String -showPpr dflags thing = showSDoc dflags (ppr thing) - -showSDocUnqual :: DynFlags -> SDoc -> String --- Only used by Haddock -showSDocUnqual dflags sdoc = showSDoc dflags sdoc - -showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String --- Allows caller to specify the PrintUnqualified to use -showSDocForUser dflags unqual doc - = renderWithStyle (initSDocContext dflags (mkUserStyle unqual AllTheWay)) doc - -showSDocDump :: DynFlags -> SDoc -> String -showSDocDump dflags d = renderWithStyle (initSDocContext dflags defaultDumpStyle) d - -showSDocDebug :: DynFlags -> SDoc -> String -showSDocDebug dflags d = renderWithStyle ctx d - where - ctx = (initSDocContext dflags defaultDumpStyle) - { sdocPprDebug = True - } - renderWithStyle :: SDocContext -> SDoc -> String renderWithStyle ctx sdoc = let s = Pretty.style{ Pretty.mode = PageMode, @@ -566,17 +506,6 @@ showSDocOneLine ctx d Pretty.renderStyle s $ runSDoc d ctx -showSDocDumpOneLine :: DynFlags -> SDoc -> String -showSDocDumpOneLine dflags d - = let s = Pretty.style{ Pretty.mode = OneLineMode, - Pretty.lineLength = irrelevantNCols } in - Pretty.renderStyle s $ - runSDoc d (initSDocContext dflags defaultDumpStyle) - -irrelevantNCols :: Int --- Used for OneLineMode and LeftMode when number of cols isn't used -irrelevantNCols = 1 - isEmpty :: SDocContext -> SDoc -> Bool isEmpty ctx sdoc = Pretty.isEmpty $ runSDoc sdoc (ctx {sdocPprDebug = True}) @@ -641,10 +570,11 @@ quotes d = sdocOption sdocCanUseUnicode $ \case False -> SDoc $ \sty -> let pp_d = runSDoc d sty str = show pp_d - in case (str, lastMaybe str) of - (_, Just '\'') -> pp_d - ('\'' : _, _) -> pp_d - _other -> Pretty.quotes pp_d + in case str of + [] -> Pretty.quotes pp_d + '\'' : _ -> pp_d + _ | '\'' <- last str -> pp_d + | otherwise -> Pretty.quotes pp_d semi, comma, colon, equals, space, dcolon, underscore, dot, vbar :: SDoc arrow, lollipop, larrow, darrow, arrowt, larrowt, arrowtt, larrowtt :: SDoc @@ -1210,96 +1140,3 @@ doOrDoes _ = text "do" itsOrTheir :: [a] -> SDoc itsOrTheir [_] = text "its" itsOrTheir _ = text "their" - -{- -************************************************************************ -* * -\subsection{Error handling} -* * -************************************************************************ --} - -callStackDoc :: HasCallStack => SDoc -callStackDoc = - hang (text "Call stack:") - 4 (vcat $ map text $ lines (prettyCallStack callStack)) - -pprPanic :: HasCallStack => String -> SDoc -> a --- ^ Throw an exception saying "bug in GHC" -pprPanic s doc = panicDoc s (doc $$ callStackDoc) - -pprSorry :: String -> SDoc -> a --- ^ Throw an exception saying "this isn't finished yet" -pprSorry = sorryDoc - - -pprPgmError :: String -> SDoc -> a --- ^ Throw an exception saying "bug in pgm being compiled" (used for unusual program errors) -pprPgmError = pgmErrorDoc - -pprTraceDebug :: String -> SDoc -> a -> a -pprTraceDebug str doc x - | debugIsOn && hasPprDebug unsafeGlobalDynFlags = pprTrace str doc x - | otherwise = x - --- | If debug output is on, show some 'SDoc' on the screen -pprTrace :: String -> SDoc -> a -> a -pprTrace str doc x = pprTraceWithFlags unsafeGlobalDynFlags str doc x - --- | If debug output is on, show some 'SDoc' on the screen -pprTraceWithFlags :: DynFlags -> String -> SDoc -> a -> a -pprTraceWithFlags dflags str doc x - | hasNoDebugOutput dflags = x - | otherwise = pprDebugAndThen dflags trace (text str) doc x - -pprTraceM :: Applicative f => String -> SDoc -> f () -pprTraceM str doc = pprTrace str doc (pure ()) - --- | @pprTraceWith desc f x@ is equivalent to @pprTrace desc (f x) x@. --- This allows you to print details from the returned value as well as from --- ambient variables. -pprTraceWith :: String -> (a -> SDoc) -> a -> a -pprTraceWith desc f x = pprTrace desc (f x) x - --- | @pprTraceIt desc x@ is equivalent to @pprTrace desc (ppr x) x@ -pprTraceIt :: Outputable a => String -> a -> a -pprTraceIt desc x = pprTraceWith desc ppr x - --- | @pprTraceException desc x action@ runs action, printing a message --- if it throws an exception. -pprTraceException :: ExceptionMonad m => String -> SDoc -> m a -> m a -pprTraceException heading doc = - handleGhcException $ \exc -> liftIO $ do - putStrLn $ showSDocDump unsafeGlobalDynFlags (sep [text heading, nest 2 doc]) - throwGhcExceptionIO exc - --- | If debug output is on, show some 'SDoc' on the screen along --- with a call stack when available. -pprSTrace :: HasCallStack => SDoc -> a -> a -pprSTrace doc = pprTrace "" (doc $$ callStackDoc) - -warnPprTrace :: HasCallStack => Bool -> String -> Int -> SDoc -> a -> a --- ^ Just warn about an assertion failure, recording the given file and line number. --- Should typically be accessed with the WARN macros -warnPprTrace _ _ _ _ x | not debugIsOn = x -warnPprTrace _ _file _line _msg x - | hasNoDebugOutput unsafeGlobalDynFlags = x -warnPprTrace False _file _line _msg x = x -warnPprTrace True file line msg x - = pprDebugAndThen unsafeGlobalDynFlags trace heading - (msg $$ callStackDoc ) - x - where - heading = hsep [text "WARNING: file", text file <> comma, text "line", int line] - --- | Panic with an assertion failure, recording the given file and --- line number. Should typically be accessed with the ASSERT family of macros -assertPprPanic :: HasCallStack => String -> Int -> SDoc -> a -assertPprPanic _file _line msg - = pprPanic "ASSERT failed!" msg - -pprDebugAndThen :: DynFlags -> (String -> a) -> SDoc -> SDoc -> a -pprDebugAndThen dflags cont heading pretty_msg - = cont (showSDocDump dflags doc) - where - doc = sep [heading, nest 2 pretty_msg] diff --git a/compiler/GHC/Utils/Outputable.hs-boot b/compiler/GHC/Utils/Outputable.hs-boot index dee3d2039c..e99b5e4f15 100644 --- a/compiler/GHC/Utils/Outputable.hs-boot +++ b/compiler/GHC/Utils/Outputable.hs-boot @@ -1,14 +1,9 @@ module GHC.Utils.Outputable where import GHC.Prelude -import GHC.Stack( HasCallStack ) data SDoc data PprStyle data SDocContext -showSDocUnsafe :: SDoc -> String - -warnPprTrace :: HasCallStack => Bool -> String -> Int -> SDoc -> a -> a - text :: String -> SDoc diff --git a/compiler/GHC/Utils/Panic.hs b/compiler/GHC/Utils/Panic.hs index 551e9337de..9f7d81abab 100644 --- a/compiler/GHC/Utils/Panic.hs +++ b/compiler/GHC/Utils/Panic.hs @@ -10,27 +10,45 @@ -- -- It's hard to put these functions anywhere else without causing -- some unnecessary loops in the module dependency graph. -module GHC.Utils.Panic ( - GhcException(..), showGhcException, - throwGhcException, throwGhcExceptionIO, - handleGhcException, - GHC.Utils.Panic.Plain.progName, - pgmError, - - panic, sorry, assertPanic, trace, - panicDoc, sorryDoc, pgmErrorDoc, - - cmdLineError, cmdLineErrorIO, - - Exception.Exception(..), showException, safeShowException, - try, tryMost, throwTo, - - withSignalHandlers, -) where +module GHC.Utils.Panic + ( GhcException(..) + , showGhcException + , showGhcExceptionUnsafe + , throwGhcException + , throwGhcExceptionIO + , handleGhcException + + , GHC.Utils.Panic.Plain.progName + , pgmError + , panic + , pprPanic + , assertPanic + , assertPprPanic + , sorry + , trace + , panicDoc + , sorryDoc + , pgmErrorDoc + , cmdLineError + , cmdLineErrorIO + , callStackDoc + + , Exception.Exception(..) + , showException + , safeShowException + , try + , tryMost + , throwTo + , withSignalHandlers + ) +where import GHC.Prelude +import GHC.Stack -import {-# SOURCE #-} GHC.Utils.Outputable (SDoc, showSDocUnsafe) +import GHC.Utils.Outputable +import {-# SOURCE #-} GHC.Driver.Session (DynFlags, unsafeGlobalDynFlags) +import {-# SOURCE #-} GHC.Driver.Ppr (showSDoc) import GHC.Utils.Panic.Plain import GHC.Utils.Exception as Exception @@ -105,9 +123,9 @@ instance Exception GhcException where | otherwise = Nothing instance Show GhcException where - showsPrec _ e@(ProgramError _) = showGhcException e - showsPrec _ e@(CmdLineError _) = showString "<command line>: " . showGhcException e - showsPrec _ e = showString progName . showString ": " . showGhcException e + showsPrec _ e@(ProgramError _) = showGhcExceptionUnsafe e + showsPrec _ e@(CmdLineError _) = showString "<command line>: " . showGhcExceptionUnsafe e + showsPrec _ e = showString progName . showString ": " . showGhcExceptionUnsafe e -- | Show an exception as a string. showException :: Exception e => e -> String @@ -132,8 +150,12 @@ safeShowException e = do -- uninitialized fields if invoked before 'GHC.initGhcMonad' has been called. -- If the error message to be printed includes a pretty-printer document -- which forces one of these fields this call may bottom. -showGhcException :: GhcException -> ShowS -showGhcException = showPlainGhcException . \case +showGhcExceptionUnsafe :: GhcException -> ShowS +showGhcExceptionUnsafe = showGhcException unsafeGlobalDynFlags + +-- | Append a description of the given exception to this string. +showGhcException :: DynFlags -> GhcException -> ShowS +showGhcException dflags = showPlainGhcException . \case Signal n -> PlainSignal n UsageError str -> PlainUsageError str CmdLineError str -> PlainCmdLineError str @@ -143,11 +165,11 @@ showGhcException = showPlainGhcException . \case ProgramError str -> PlainProgramError str PprPanic str sdoc -> PlainPanic $ - concat [str, "\n\n", showSDocUnsafe sdoc] + concat [str, "\n\n", showSDoc dflags sdoc] PprSorry str sdoc -> PlainProgramError $ - concat [str, "\n\n", showSDocUnsafe sdoc] + concat [str, "\n\n", showSDoc dflags sdoc] PprProgramError str sdoc -> PlainProgramError $ - concat [str, "\n\n", showSDocUnsafe sdoc] + concat [str, "\n\n", showSDoc dflags sdoc] throwGhcException :: GhcException -> a throwGhcException = Exception.throw @@ -158,9 +180,20 @@ throwGhcExceptionIO = Exception.throwIO handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a handleGhcException = MC.handle -panicDoc, sorryDoc, pgmErrorDoc :: String -> SDoc -> a -panicDoc x doc = throwGhcException (PprPanic x doc) -sorryDoc x doc = throwGhcException (PprSorry x doc) +-- | Throw an exception saying "bug in GHC" with a callstack +pprPanic :: HasCallStack => String -> SDoc -> a +pprPanic s doc = panicDoc s (doc $$ callStackDoc) + +-- | Throw an exception saying "bug in GHC" +panicDoc :: String -> SDoc -> a +panicDoc x doc = throwGhcException (PprPanic x doc) + +-- | Throw an exception saying "this isn't finished yet" +sorryDoc :: String -> SDoc -> a +sorryDoc x doc = throwGhcException (PprSorry x doc) + +-- | Throw an exception saying "bug in pgm being compiled" (used for unusual program errors) +pgmErrorDoc :: String -> SDoc -> a pgmErrorDoc x doc = throwGhcException (PprProgramError x doc) -- | Like try, but pass through UserInterrupt and Panic exceptions. @@ -258,3 +291,14 @@ withSignalHandlers act = do mayInstallHandlers act `MC.finally` mayUninstallHandlers + +callStackDoc :: HasCallStack => SDoc +callStackDoc = + hang (text "Call stack:") + 4 (vcat $ map text $ lines (prettyCallStack callStack)) + +-- | Panic with an assertion failure, recording the given file and +-- line number. Should typically be accessed with the ASSERT family of macros +assertPprPanic :: HasCallStack => String -> Int -> SDoc -> a +assertPprPanic _file _line msg + = pprPanic "ASSERT failed!" msg diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 1372a187d9..a321aca4dd 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -181,6 +181,7 @@ Library GHC.Driver.Monad GHC.Driver.Hooks GHC.Driver.Flags + GHC.Driver.Ppr GHC.Types.Id GHC.Types.Id.Info GHC.Core.Predicate diff --git a/ghc/GHCi/Leak.hs b/ghc/GHCi/Leak.hs index e6a11cb9af..88c64ecc15 100644 --- a/ghc/GHCi/Leak.hs +++ b/ghc/GHCi/Leak.hs @@ -12,6 +12,7 @@ import GHC import GHC.Ptr (Ptr (..)) import GHCi.Util import GHC.Driver.Types +import GHC.Driver.Ppr import GHC.Utils.Outputable import GHC.Platform (target32Bit) import Prelude diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 7180bc71ac..7cef2dd423 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -42,6 +42,7 @@ import GHC.Runtime.Interpreter.Types import GHCi.RemoteTypes import GHCi.BreakArray import GHC.Driver.Session as DynFlags +import GHC.Driver.Ppr hiding (printForUser) import GHC.Utils.Error hiding (traceCmd) import GHC.Driver.Finder as Finder import GHC.Driver.Monad ( modifySession ) @@ -69,7 +70,7 @@ import GHC.Types.SrcLoc as SrcLoc import qualified GHC.Parser.Lexer as Lexer import GHC.Data.StringBuffer -import GHC.Utils.Outputable hiding ( printForUser ) +import GHC.Utils.Outputable import GHC.Runtime.Loader ( initializePlugins ) @@ -3430,8 +3431,9 @@ completeBreakpoint = wrapCompleter spaces $ \w -> do -- #3000 -- Extract all bids from all top-level identifiers in scope. bidsFromInscopes :: GhciMonad m => m [String] bidsFromInscopes = do + dflags <- getDynFlags rdrs <- GHC.getRdrNamesInScope - inscopess <- mapM createInscope $ (showSDocUnsafe . ppr) <$> rdrs + inscopess <- mapM createInscope $ (showSDoc dflags . ppr) <$> rdrs imods <- interpretedHomeMods let topLevels = filter ((`elem` imods) . snd) $ concat inscopess bidss <- mapM (addNestedDecls) topLevels diff --git a/ghc/GHCi/UI/Info.hs b/ghc/GHCi/UI/Info.hs index 2b035e4428..7466a28ce8 100644 --- a/ghc/GHCi/UI/Info.hs +++ b/ghc/GHCi/UI/Info.hs @@ -38,6 +38,7 @@ import GHC.Driver.Session (HasDynFlags(..)) import GHC.Data.FastString import GHC import GHC.Driver.Monad +import GHC.Driver.Ppr import GHC.Types.Name import GHC.Types.Name.Set import GHC.Utils.Outputable diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index 63f330d86c..8c5baeee90 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -38,8 +38,8 @@ module GHCi.UI.Monad ( import GHCi.UI.Info (ModInfo) import qualified GHC import GHC.Driver.Monad hiding (liftIO) -import GHC.Utils.Outputable hiding (printForUser) -import qualified GHC.Utils.Outputable as Outputable +import GHC.Utils.Outputable +import qualified GHC.Driver.Ppr as Ppr import GHC.Types.Name.Occurrence import GHC.Driver.Session import GHC.Data.FastString @@ -235,7 +235,7 @@ prettyLocations locs = instance Outputable BreakLocation where ppr loc = (ppr $ breakModule loc) <+> ppr (breakLoc loc) <+> pprEnaDisa <+> if null (onBreakCmd loc) - then Outputable.empty + then empty else doubleQuotes (text (onBreakCmd loc)) where pprEnaDisa = case breakEnabled loc of True -> text "enabled" @@ -331,26 +331,26 @@ unsetOption opt printForUserNeverQualify :: GhcMonad m => SDoc -> m () printForUserNeverQualify doc = do dflags <- getDynFlags - liftIO $ Outputable.printForUser dflags stdout neverQualify AllTheWay doc + liftIO $ Ppr.printForUser dflags stdout neverQualify AllTheWay doc printForUserModInfo :: GhcMonad m => GHC.ModuleInfo -> SDoc -> m () printForUserModInfo info doc = do dflags <- getDynFlags mUnqual <- GHC.mkPrintUnqualifiedForModule info unqual <- maybe GHC.getPrintUnqual return mUnqual - liftIO $ Outputable.printForUser dflags stdout unqual AllTheWay doc + liftIO $ Ppr.printForUser dflags stdout unqual AllTheWay doc printForUser :: GhcMonad m => SDoc -> m () printForUser doc = do unqual <- GHC.getPrintUnqual dflags <- getDynFlags - liftIO $ Outputable.printForUser dflags stdout unqual AllTheWay doc + liftIO $ Ppr.printForUser dflags stdout unqual AllTheWay doc printForUserPartWay :: GhcMonad m => SDoc -> m () printForUserPartWay doc = do unqual <- GHC.getPrintUnqual dflags <- getDynFlags - liftIO $ Outputable.printForUser dflags stdout unqual Outputable.DefaultDepth doc + liftIO $ Ppr.printForUser dflags stdout unqual DefaultDepth doc -- | Run a single Haskell expression runStmt @@ -438,7 +438,7 @@ runWithStats getAllocs action = do printStats :: DynFlags -> ActionStats -> IO () printStats dflags ActionStats{actionAllocs = mallocs, actionElapsedTime = secs} = do let secs_str = showFFloat (Just 2) secs - putStrLn (showSDoc dflags ( + putStrLn (Ppr.showSDoc dflags ( parens (text (secs_str "") <+> text "secs" <> comma <+> case mallocs of Nothing -> empty diff --git a/ghc/GHCi/UI/Tags.hs b/ghc/GHCi/UI/Tags.hs index 9f4dfa6e53..bc86f39766 100644 --- a/ghc/GHCi/UI/Tags.hs +++ b/ghc/GHCi/UI/Tags.hs @@ -31,6 +31,7 @@ import Data.List import Data.Maybe import Data.Ord import GHC.Driver.Phases +import GHC.Driver.Ppr import GHC.Utils.Panic import Prelude import System.Directory diff --git a/ghc/Main.hs b/ghc/Main.hs index fa6608761d..06a26c45ae 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -51,6 +51,7 @@ import GHC.Unit.State ( pprUnits, pprUnitsSimple ) import GHC.Driver.Phases import GHC.Types.Basic ( failed ) import GHC.Driver.Session hiding (WarnReason(..)) +import GHC.Driver.Ppr import GHC.Utils.Error import GHC.Data.FastString import GHC.Utils.Outputable as Outputable diff --git a/testsuite/tests/ghc-api/T18522-dbg-ppr.hs b/testsuite/tests/ghc-api/T18522-dbg-ppr.hs index 3b14cc1d8a..8b31eb683d 100644 --- a/testsuite/tests/ghc-api/T18522-dbg-ppr.hs +++ b/testsuite/tests/ghc-api/T18522-dbg-ppr.hs @@ -12,6 +12,7 @@ import GHC.Tc.Module import GHC.Tc.Utils.Zonk import GHC.Utils.Error import GHC.Driver.Types +import GHC.Driver.Ppr import GHC import qualified GHC.LanguageExtensions as LangExt diff --git a/testsuite/tests/ghc-api/T4891/T4891.hs b/testsuite/tests/ghc-api/T4891/T4891.hs index 4da3acba18..201293178d 100644 --- a/testsuite/tests/ghc-api/T4891/T4891.hs +++ b/testsuite/tests/ghc-api/T4891/T4891.hs @@ -8,6 +8,7 @@ import GHC.Core.DataCon import GHC import GHC.Exts.Heap import GHC.Driver.Types +import GHC.Driver.Ppr import GHC.Runtime.Linker import GHC.Runtime.Heap.Inspect import GHC.Tc.Utils.Env diff --git a/testsuite/tests/ghc-api/T7478/T7478.hs b/testsuite/tests/ghc-api/T7478/T7478.hs index 2e5c735c9c..2fa0f6095e 100644 --- a/testsuite/tests/ghc-api/T7478/T7478.hs +++ b/testsuite/tests/ghc-api/T7478/T7478.hs @@ -8,6 +8,7 @@ import System.Environment import GHC import qualified GHC.Settings.Config as GHC import qualified GHC.Utils.Outputable as GHC +import qualified GHC.Driver.Ppr as GHC import GHC.Driver.Monad (liftIO) import GHC.Utils.Outputable (PprStyle, queryQual) diff --git a/testsuite/tests/ghc-api/T8639_api.hs b/testsuite/tests/ghc-api/T8639_api.hs index 3b7648e397..9c3fa3b7ab 100644 --- a/testsuite/tests/ghc-api/T8639_api.hs +++ b/testsuite/tests/ghc-api/T8639_api.hs @@ -2,6 +2,7 @@ module Main where import GHC import GHC.Driver.Monad +import GHC.Driver.Ppr import GHC.Utils.Outputable import System.IO import System.Environment( getArgs ) diff --git a/testsuite/tests/ghc-api/annotations-literals/literals.hs b/testsuite/tests/ghc-api/annotations-literals/literals.hs index 64c0311c07..c216513a90 100644 --- a/testsuite/tests/ghc-api/annotations-literals/literals.hs +++ b/testsuite/tests/ghc-api/annotations-literals/literals.hs @@ -8,6 +8,7 @@ import Data.List (intercalate) import System.IO import GHC import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Data.Bag (filterBag,isEmptyBag) @@ -40,4 +41,4 @@ showToks ts = intercalate ",\n\n" $ map (\((L p t),s) -> "(" ++ pp p ++ "," ++ show t ++ ",[" ++ s ++ "])") ts -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a diff --git a/testsuite/tests/ghc-api/annotations-literals/parsed.hs b/testsuite/tests/ghc-api/annotations-literals/parsed.hs index 620bf0451e..3b35373f93 100644 --- a/testsuite/tests/ghc-api/annotations-literals/parsed.hs +++ b/testsuite/tests/ghc-api/annotations-literals/parsed.hs @@ -9,6 +9,7 @@ import Data.List (intercalate) import System.IO import GHC import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Data.Bag (filterBag,isEmptyBag) @@ -71,7 +72,7 @@ testOneFile libdir fileName = do = ["HsIsString [" ++ src ++ "] " ++ show c] doOverLit _ = [] -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/annotations/CheckUtils.hs b/testsuite/tests/ghc-api/annotations/CheckUtils.hs index 3f79f48e28..d3a2b3d80e 100644 --- a/testsuite/tests/ghc-api/annotations/CheckUtils.hs +++ b/testsuite/tests/ghc-api/annotations/CheckUtils.hs @@ -10,6 +10,7 @@ import System.IO import GHC import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Parser.Annotation @@ -76,7 +77,7 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/annotations/annotations.hs b/testsuite/tests/ghc-api/annotations/annotations.hs index 8347b57ffc..933170deb2 100644 --- a/testsuite/tests/ghc-api/annotations/annotations.hs +++ b/testsuite/tests/ghc-api/annotations/annotations.hs @@ -10,6 +10,7 @@ import Data.List (intercalate) import System.IO import GHC import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Data.Bag (filterBag,isEmptyBag) @@ -58,4 +59,4 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a diff --git a/testsuite/tests/ghc-api/annotations/comments.hs b/testsuite/tests/ghc-api/annotations/comments.hs index 4da8cbda54..8497c87eda 100644 --- a/testsuite/tests/ghc-api/annotations/comments.hs +++ b/testsuite/tests/ghc-api/annotations/comments.hs @@ -10,6 +10,7 @@ import Data.List (intercalate) import System.IO import GHC import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Data.Bag (filterBag,isEmptyBag) @@ -67,4 +68,4 @@ showAnns anns = "[\n" ++ (intercalate "\n" showToks ts = intercalate ",\n\n" $ map (\(L p t) -> "(" ++ pp p ++ "," ++ show t ++ ")") ts -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a diff --git a/testsuite/tests/ghc-api/annotations/listcomps.hs b/testsuite/tests/ghc-api/annotations/listcomps.hs index ddc0b7ec7f..115aef6527 100644 --- a/testsuite/tests/ghc-api/annotations/listcomps.hs +++ b/testsuite/tests/ghc-api/annotations/listcomps.hs @@ -11,6 +11,7 @@ import System.IO import GHC import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Parser.Annotation @@ -70,7 +71,7 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/annotations/parseTree.hs b/testsuite/tests/ghc-api/annotations/parseTree.hs index 9c167787be..f566c51d6f 100644 --- a/testsuite/tests/ghc-api/annotations/parseTree.hs +++ b/testsuite/tests/ghc-api/annotations/parseTree.hs @@ -11,6 +11,7 @@ import System.IO import GHC import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Data.Bag (filterBag,isEmptyBag) @@ -64,7 +65,7 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/annotations/stringSource.hs b/testsuite/tests/ghc-api/annotations/stringSource.hs index 2bc2638e84..7c35c88996 100644 --- a/testsuite/tests/ghc-api/annotations/stringSource.hs +++ b/testsuite/tests/ghc-api/annotations/stringSource.hs @@ -13,6 +13,7 @@ import System.IO import GHC import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import GHC.Types.ForeignCall import GHC.Utils.Monad @@ -95,7 +96,7 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/annotations/t11430.hs b/testsuite/tests/ghc-api/annotations/t11430.hs index d8be3d1043..c7f5801d59 100644 --- a/testsuite/tests/ghc-api/annotations/t11430.hs +++ b/testsuite/tests/ghc-api/annotations/t11430.hs @@ -13,6 +13,7 @@ import System.IO import GHC import GHC.Types.Basic import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Data.FastString import GHC.Types.ForeignCall import GHC.Utils.Monad @@ -82,7 +83,7 @@ showAnns anns = "[\n" ++ (intercalate "\n" $ Map.toList anns) ++ "]\n" -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs index 7c782c9167..732321935b 100644 --- a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs +++ b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs @@ -166,7 +166,7 @@ go label mods cnd = hsc_env <- getSession emss <- liftIO $ downsweep hsc_env [] [] False - -- liftIO $ hPutStrLn stderr $ showSDocUnsafe $ ppr $ rights emss + -- liftIO $ hPutStrLn stderr $ showSDoc (hsc_dflags hsc_env) $ ppr $ rights emss -- liftIO $ hPrint stderr $ bagToList $ unionManyBags $ lefts emss it label $ cnd (rights emss) diff --git a/testsuite/tests/hiefile/should_run/HieQueries.hs b/testsuite/tests/hiefile/should_run/HieQueries.hs index f349854dc4..f0b3ee5ba2 100644 --- a/testsuite/tests/hiefile/should_run/HieQueries.hs +++ b/testsuite/tests/hiefile/should_run/HieQueries.hs @@ -14,7 +14,7 @@ import GHC.Iface.Ext.Utils import Data.Maybe (fromJust) import GHC.Driver.Session import GHC.SysTools -import GHC.Utils.Outputable ( Outputable, renderWithStyle, ppr, defaultUserStyle, initSDocContext, text) +import GHC.Utils.Outputable ( Outputable, renderWithStyle, ppr, defaultUserStyle, text) import qualified Data.Map as M import Data.Foldable diff --git a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs index 9481f6e018..1dba8ff3c0 100644 --- a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs +++ b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs @@ -10,6 +10,7 @@ import GHC.Tc.Types import GHC.Hs.Extension import GHC.Hs.Expr import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.SrcLoc import GHC.Hs import GHC.Hs.Binds diff --git a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs index 4e0eec36c0..dfadc4bc8b 100644 --- a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs +++ b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs @@ -4,7 +4,9 @@ import Control.Monad.IO.Class import Data.List (intercalate) import Data.Maybe (isJust) import GHC.Driver.Plugins +import GHC.Driver.Session import GHC.Driver.Types +import GHC.Driver.Ppr import GHC.Tc.Types import GHC.Hs.Extension import GHC.Types.Avail @@ -42,11 +44,13 @@ typecheckPlugin _ _ tc metaPlugin' :: [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc) metaPlugin' _ meta - = do liftIO $ putStrLn $ "metaPlugin: " ++ (showSDocUnsafe $ ppr meta) + = do dflags <- getDynFlags + liftIO $ putStrLn $ "metaPlugin: " ++ (showSDoc dflags $ ppr meta) return meta interfaceLoadPlugin' :: [CommandLineOption] -> ModIface -> IfM lcl ModIface interfaceLoadPlugin' _ iface - = do liftIO $ putStrLn $ "interfacePlugin: " - ++ (showSDocUnsafe $ ppr $ mi_module iface) + = do dflags <- getDynFlags + liftIO $ putStrLn $ "interfacePlugin: " + ++ (showSDoc dflags $ ppr $ mi_module iface) return iface diff --git a/testsuite/tests/quasiquotation/T7918.hs b/testsuite/tests/quasiquotation/T7918.hs index 1a7de12d42..74cd57ee0f 100644 --- a/testsuite/tests/quasiquotation/T7918.hs +++ b/testsuite/tests/quasiquotation/T7918.hs @@ -3,6 +3,7 @@ module Main (main) where import GHC import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable import GHC.Utils.Monad import GHC.Types.Name.Set diff --git a/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs b/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs index e9cd3f34f4..abd7ee5739 100644 --- a/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs +++ b/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs @@ -4,6 +4,7 @@ import GHC.Types.Basic import GHC import GHC.Driver.Monad import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Types.RepType import GHC.Builtin.Types.Prim import GHC.Builtin.Types diff --git a/utils/check-api-annotations/Main.hs b/utils/check-api-annotations/Main.hs index 9358359f6d..7fd6180182 100644 --- a/utils/check-api-annotations/Main.hs +++ b/utils/check-api-annotations/Main.hs @@ -3,7 +3,7 @@ import Data.Data import Data.List import GHC -import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable import GHC.Types.SrcLoc import System.Environment( getArgs ) @@ -96,7 +96,7 @@ showAnnsList annsList = "[\n" ++ (intercalate ",\n" ++ "\n]\n" pp :: (Outputable a) => a -> String -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a -- --------------------------------------------------------------------- diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs index 9bc776d4d5..9d025633ef 100644 --- a/utils/check-ppr/Main.hs +++ b/utils/check-ppr/Main.hs @@ -9,6 +9,7 @@ import GHC.Types.SrcLoc import GHC hiding (moduleName) import GHC.Hs.Dump import GHC.Driver.Session +import GHC.Driver.Ppr import GHC.Utils.Outputable hiding (space) import System.Environment( getArgs ) import System.Exit @@ -33,7 +34,7 @@ testOneFile :: FilePath -> String -> IO () testOneFile libdir fileName = do p <- parseOneFile libdir fileName let - origAst = showSDoc unsafeGlobalDynFlags + origAst = showPprUnsafe $ showAstData BlankSrcSpan $ eraseLayoutInfo (pm_parsed_source p) pped = pragmas ++ "\n" ++ pp (pm_parsed_source p) @@ -50,7 +51,7 @@ testOneFile libdir fileName = do p' <- parseOneFile libdir newFile let newAstStr :: String - newAstStr = showSDoc unsafeGlobalDynFlags + newAstStr = showPprUnsafe $ showAstData BlankSrcSpan $ eraseLayoutInfo (pm_parsed_source p') writeFile newAstFile newAstStr @@ -102,7 +103,7 @@ getPragmas anns = pragmaStr pragmaStr = intercalate "\n" pragmas pp :: (Outputable a) => a -> String -pp a = showPpr unsafeGlobalDynFlags a +pp a = showPprUnsafe a eraseLayoutInfo :: ParsedSource -> ParsedSource eraseLayoutInfo = everywhere go diff --git a/utils/haddock b/utils/haddock -Subproject 7e6628febc482b4ad451f49ad416722375d1b17 +Subproject 7de9589e0191bbd79521597d35c2a0c68d2c9ad |