Skip to content
Edward Z. Yang edited this page Sep 8, 2015 · 4 revisions

Backpack in Cabal

This page describes the proposed modifications to Cabal and cabal-install in order to support Backpack, a new module system for Haskell.

It has a companion page on the GHC Trac: https://ghc.haskell.org/trac/ghc/wiki/Backpack

In what ways does Backpack affect Cabal/cabal-install?

The bulk of the implementation of Backpack lives in GHC, which in principle allows us to write a specification for Backpack without any reference to Cabal. However, there are a few important points by which Backpack interacts with Cabal:

  1. A Backpack file replaces a set of modules specified by exposed-modules with a Backpack file; Cabal must be told where this Backpack file lives (a backpack-file field) and must call GHC differently (--backpack) to actual compile it.

  2. A Backpack file can define multiple units, analogous to the way Cabal files can define multiple components (e.g. a library as well as a test suite library). Each of these units must have an a/so/dll library created for it and be registered individually in the installed unit database. Cabal is responsible for both of these operations.

  3. A Backpack file can define an indefinite unit, which is a unit that cannot be compiled to code because it has some requirements that will be filled by a later client of the unit. The results of typechecking such a unit must be registered in the indefinite unit database (a Cabal operation), and cabal-install is responsible for recompiling the unit when a specific instantiation is required by an install plan.

The first point is a relatively minor change to Cabal; however the second and third points require some major architectural changes to Cabal's model.

Clone this wiki locally