Skip to content

Add PlainPanic for throwing exceptions without depending on pprint

Michael Sloan requested to merge mgsloan/ghc:wip/plain-panic into master

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:

  1. To avoid cycles / use of boot files, these dependencies cannot throw GhcException.

  2. There are some utility modules that use UnboxedTuples and also use panic. 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

Merge request reports