34 Humake -- a distributed and parallel make tool for Haskell

Humake is a tool for compiling Haskell programs. It allows independent modules to be compiled in parallel, possibly on different computers. It has a graphical user interface (see Figure 92) where the progress of the compilation can be monitored and information on individual modules can be obtained. The module-dependency graph is automatically extracted from the source code. The dependency graph, file-modification dates and other module information is retained between compilations and can be dynamically updated when a module is changed, to minimise the work required to start a recompilation and thus make the edit-compile-test development cycle faster.

Figure 92. The user interface of Humake.

In the current version, the user interface shows

34.1 Implementation

The structure of the implementation is sketched in Figure 93. Most of the work is handled by the fudget dependencyF. It traverses the modules to extract the module-dependency graph and builds a representation of it. It also maintains a data structure representing the status of the compilation process. This structure is chosen so that when a compilation completes, or a module is updated, a new compilation can be started as quickly as possible.

The source is about 1200 lines long.

main = fudlogue $ shellF "Humake" humakeF

humakeF =
  loopLeftF ((moduleInfoF>+<parallelCompileF) >==< dependencyF)
    >==< editorInterfaceF

--- GUI fudgets:

statusDisplayF = ... --the bottom part of the window

moduleInfoF = ... -- the module list, module info and the update buttons

--- Non-GUI fudgets:

parallelCompileF =
    filterRightSP >^^=< (statusDisplayF>+<idF) >==<
    loopThroughRightF (absF ctrlSP) (parServerF hosts compileF)
    ctrlSP = ...

parServerF :: [id] -> (id->F req resp) -> F req resp
parServerF ids serverF = ... -- essentially as in Figure 88

compileF :: String -> F CompilerReq CompilerResp
compileF host = ... -- a compilation server

editorInterfaceF :: F a String
editorInterfaceF = ... -- outputs the name of a file when it is saved

Figure 93. Implementation of Humake.