GHC/Redesign
Jump to navigation
Jump to search
This page is a draft.
Goals:
- 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.
Compilation interface
Current interface:
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) | |||
Byte code | |||
Nothing (type-check) |
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.
Desired interface:
load :: Session - [Targets] -> ?