Fixes to dealing with the export of main (Fix #19397)
It's surprisingly tricky to deal with 'main' (#19397 (closed)). This patch does quite bit of refactoring do to it right. Well, more-right anyway!
The moving parts are documented in GHC.Tc.Module Note [Dealing with main]
Some other oddments:
-
Rename tcRnExports to rnExports; no typechecking here!
-
rnExports now uses checkNoErrs rather than failIfErrsM; the former fails only if rnExports itself finds errors
-
Small improvements to tcTyThingCategory, which ultimately weren't important to the patch, but I've retained as a minor improvement.