Add PlainPanic for throwing exceptions without depending on pprint
This commit splits out a subset of GhcException which do not depend on
pretty printing (SDoc), as a new datatype called
PlainGhcException
. These exceptions can be caught as GhcException
,
because fromException
will convert them.
The motivation for this change is that that the Panic module transitively depends on many modules, primarily due to pretty printing code. It's on the order of about 130 modules. This large set of dependencies has a few implications:
-
To avoid cycles / use of boot files, these dependencies cannot throw
GhcException
. -
There are some utility modules that use
UnboxedTuples
and also usepanic
. This means that when loading GHC into GHCi, about 130 additional modules would need to be compiled instead of interpreted. Splitting the non-pprint exception throwing into a new module resolves this issue. See #13101