Personal tools

GHC/Redesign

From HaskellWiki

< GHC
Revision as of 07:40, 7 May 2006 by Lemmih (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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] -> ?