This page is a draft.
- Separate the GHC specific logic from the library.
- Make better use of the type-system! A lot of GHC is written as if Haskell were dynamically typed.
- Cut down on global mutable variables.
data LoadHowMuch = LoadAllTargets | LoadUpTo Module | LoadDependenciesOf Module -- 'hscTarget' and 'ghcMode' governs the exact behaviour. load :: Session -> LoadHowMuch -> IO SuccessFlag
However, there're many invalid combinations of 'hscTarget' and 'ghcMode'.
|hscTarget \ ghcMode||Batch||OneShot||Interactive|
|Hard code (C,asm,etc)||
For example, if you set 'ghcMode' to Interactive without changing 'hscTarget' from its 'HscC' default, ghc will try to run 'gcc' on a non-existing file. I'd like to describe the behaviour of 'load' via function composition instead of mutable flags. Moreover, I'd like to remove the targets, module graph and interactive context from the HscEnv.
load :: Session - [Targets] -> ?