Search code examples
haskellcabalcabal-install

Haskell Cabal: locally fix a broken package DL'ed from Hackage


Suppose that I ran cabal sandbox init .. cabal install -j some-package and got a build failure in one of dependencies of some-package. One way to solve this is I notify the author of the failure and then wait for them to release a new version, but the process can sometimes be too slow. When the reason of the failure is obvious (which is often the case,) I want to launch my text editor and fix it by myself.

However when I ran find(1) for the filename from the error log in .cabal-sandbox cache directory, I could find no .hs files. Does the cabal command remove the entire source directory when GHC successfully or unsuccessfully finishes its execution? How can I intrude into cabal's task executions? Or, are there any standardized way to achieve my original goal of fixing software packages from Hackage by myself?


Solution

  • You can download package source with cabal get <package> then fix it and install into sandbox with cabal install <package-dir>.

    E.g.

    $ cabal get split
    Unpacking to split-0.2.2/
    $ vim split-0.2.2/split.cabal
    $ cabal install ./split-0.2.2