Mafia is a wrapper for cabal-install
that eliminates most of the pain points, without the need for a blessed set of packages.
Put the wrapper script somewhere on your path:
cd $HOME/bin && wget https://raw.githubusercontent.com/ambiata/mafia/master/script/mafia
Jump into a git repository with a Haskell project inside, and try to build it. This will compile mafia first, then build all dependencies (including any contained in git submodules or the local repository!) in the global cache. Finally, it builds the local cabal project, and all test suites, with -Wall -Werror
.
cd $HOME/src/cryptol && mafia build
Upgrade the script to the latest version with mafia upgrade
.
As long as you have a project in a git repo, mafia build
mafia test
and mafia bench
are all you need. It's especially nice to avoid the elaborate sandbox dance when using local dependencies, which are found automatically from any directory or submodule in the repo. (One condition: the top-level project you're building cannot be in a submodule.)
The global cache is cool. After building each dependency and placing it in the global cache, mafia takes cabal's buildplan and links each dep into a local sandbox:
cd /tmp
git clone https://github.com/GaloisInc/cryptol
cd cryptol
mafia build # All deps cached from last time
... although it can grow quite large over time, as it is forced to consider the transitive set of dependencies, the hashes of each file in the package's sdist, and the sdist file list itself.
If you are maintaining software between various versions of GHC, mafia turns this into a zero-effort endeavour (excepting the time it takes to compile all of your dependencies once.) Each version has its own global cache, so rebuilding the project sandbox with symlinks takes no time at all. Just put a different GHC onto your path, and things should just work.