| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
ReWire.GHC.Session
Description
The GHC-driven front end, part one: an in-process GHC session that
drives parse -> rename -> typecheck -> desugar over the whole home
module graph and hands back the (-O0, pre-simplifier) desugared Core,
one ModGuts per home module in dependency order.
Wrinkles this module exists to handle:
- The desugarer runs GHC's simple optimizer unconditionally, and its
occurrence analysis drops top-level binds unreachable from an
exported binder -- even at -O0. A file with no module header is
implicitly
module Main (main) where, so everything butmainwould vanish.ensureLiveExportsrewrites the parsed module before typechecking: headerless modules become export-all. mg_bindsis strictly per-module: the target's guts contain no code from imported modules (including all of rewire-user, compiled from source via the loadpath). So every home module is desugared, not just the target.- GHC reports errors as
SourceErrorexceptions (from the per-module phases) or through the log action (duringload); warnings only via the log action. Both are re-routed through ReWire'sAstError/warnAtmachinery so-w/-Werrorand the usual error formatting (filename included) keep working.