Sunday, May 29, 2011

Starting Google Summer of Code

This summer I've been given the privilege of working on Cabal for the Google Summer of Code.

The project, originally described here and here, is to facilitate the interpretation of Cabal packages through GHCi. More specifically, I'll be doing the following:
  • I'll create a GhcOptions record containing all the options needed to build a package. Two options are particularly important:
    • The ghcOptMode option determines what type of build is going on. This could be one of LibMode, ExecMode, AbiHashMode, or GhciMode. The build function performs whatever type of build is necessary based on this context.
    • The ghcOptStage option determines what part of the build process needs to be rendered into a ProgramInvocation. This could be the building of C Sources, pre-building for Template Haskell, building haskell sources, or linking. Based on the current stage, the render function returns a ProgramInvocation with the necessary set of options for GHC.
    This means that the GhcOptions record is used for two separate generic functions, build and render.
  • Creating these records isn't something users should have to do manually, so I'll also be making counterparts to the old buildExe, buildLib, and buildAbiHash functions that bundle the required information into a nice tidy GhcOptions record before sending it off to build. Additionally, there will be an interpret function for bundling the options required for interpretation. A compiler agnostic version of interpret, repl, will appear in the high level Build.hs file, although I don't plan to add support for other compilers.
  • Next I make the repl function accessible as a command, giving it hooks and a CommandUI spec while showing it to cabal-install's long list of possible commands.
  • Then there's all those fun commands in GHCi that require rebuilding (:reload, :load, etc). Fortunately, I can overload these with macros that perform whatever special cabal stuff needs to be done first and feed these on the sly to GHCi.

No comments:

Post a Comment