haskellcabalhackage

How to install a dev branch into a Cabal Sandbox


I have a project in a Cabal sandbox. There is a package I would like to use but the one on Hackage isn't suitable. There is an alternative dev branch that should meet my needs that the author has on Github. I've previously installed dev branches without a sandbox by using:

$ runhaskell Setup.hs configure --user
$ runhaskell Setup.hs build
$ runhaskell Setup.hs install

Obviously that's not going to work if I only want this repo installed in the sandbox.

My directory structure is set up like this:

../MyProject
../MyProject/.cabal-sandbox
../MyProject/exec/Main.hs
../MyProject/src/MyProject.hs
../MyProject/MyProject.cabal

There's both an executable and a library. My build-depends has about 18 package dependencies, of which this is one. So my questions:

  1. Once I've downloaded the dev repo, where should I extract it to?
  2. Once extracted, how do I build/install into my sandbox?
  3. Once that's all done, do I need to modify my .cabal file at all?

Solution

  • Reproducing the correct answer as community-wiki from the comments:

    Try cabal sandbox add-source. See coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html for an example.