I'm attempting to use CircleCI to build some Haskell projects. Circle automatically caches the /home/ubuntu/.cabal
directory after each build and I thought that would speed up the builds, but they seem to take just as long as before---all that's skipped is the download step.
The build instructions I'm using are
cabal update
cabal install --only-dependencies --enable-tests
cabal configure --enable-tests
cabal build
cabal test
and I anticipated that install --only-dependencies
step would see the cache and run more quickly.
What might be going wrong?
There was an excellent Reddit discussion of cabal issues a few months back. My recollection is that Haskell has no specified application binary interface, and that the ghc
compiler does a lot of aggressive inter-library graph reductions during compilation. As a result, there is no such thing as a stable library installation in a Haskell app -- any library is liable to be dragged down and recompiled against the full set of already-installed libraries.
The bottom line here is that caching the .cabal/lib
directory does nothing to speed installation. Recompilation of dependencies will always happen. Your best approach, aside from sandboxing using hsenv
, is to specify your full set of dependent libraries when you call cabal install
. That way, the dependencies can be calculated ahead of time, and compilation should only occur once.
Haskell gurus, please feel free to correct me if anything I said here is mistaken. I have been out of the Haskell loop for a few months, and I'm aware that cabal/library issues have received a lot of attention lately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With