• Matthew Pickering's avatar
    Multiple Home Units · fd42ab5f
    Matthew Pickering authored
    Multiple home units allows you to load different packages which may depend on
    each other into one GHC session. This will allow both GHCi and HLS to support
    multi component projects more naturally.
    
    Public Interface
    ~~~~~~~~~~~~~~~~
    
    In order to specify multiple units, the -unit @⟨filename⟩ flag
    is given multiple times with a response file containing the arguments for each unit.
    The response file contains a newline separated list of arguments.
    
    ```
    ghc -unit @unitLibCore -unit @unitLib
    ```
    
    where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode.
    
    ```
    -this-unit-id lib-core-0.1.0.0
    -i
    -isrc
    LibCore.Utils
    LibCore.Types
    ```
    
    The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core.
    
    ```
    -this-unit-id lib-0.1.0.0
    -package-id lib-core-0.1.0.0
    -i
    -isrc
    Lib.Parse
    Lib.Render
    ```
    
    Then when the compiler starts in --make mode it will compile both units lib and lib-core.
    
    There is a...
    fd42ab5f
Code owners : Ben Gamari
Main.hs 2.86 KB