Search code examples
haskellcabal

Cabal: where does `cabal update` store its package list?


(I'm on OS X 10.9)

I run this:

$ cabal update
$ cabal install haskell-platform 
cabal: There is no package named 'haskell-platform'.
You may need to run 'cabal update' to get the latest list of available packages.

I installed cabal-install with user:

$ cabal install --user cabal-install
$ which cabal
/Users/sambo/.cabal/bin/cabal

after nuking my Haskell installation with with this that I found online:

$ sudo rm -rf /Library/Frameworks/GHC.framework
$ sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
$ sudo rm -rf /Library/Haskell
$ sudo rm -rf /usr/share/doc/ghc
$ sudo rm /usr/share/man/man1/ghc.1
$ sudo rm -rf /var/db/receipts/org.haskell.HaskellPlatform.*
$ sudo rm -rf ~/.cabal
$ sudo rm -rf ~/.ghc
$ sudo rm -rf ~/Library/Haskell
$ find /usr/bin /usr/local/bin -type l | \
  xargs -If sh -c '/bin/echo -n f /; readlink f' | \
    egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | \
    cut -f 1 -d ' ' | \
    xargs sudo rm -f

I'd be okay with a hard reinstall of Haskell, which I had installed with homebrew. Which is what I was trying to do, but seems botched.


Solution

  • I don't really understand your problem, but Cabal stores package list in:

    .cabal/packages/hackage.haskell.org/00-index.tar.gz.etag
    .cabal/packages/hackage.haskell.org/00-index.cache
    .cabal/packages/hackage.haskell.org/00-index.tar.gz
    .cabal/packages/hackage.haskell.org/00-index.tar
    

    Here's a tip to manage your Haskell installation: Don't install Haskell Platform. Using your package manager(I guess that's brew on a Mac), install latest GHC(7.8.3), Cabal and cabal-install. After that run cabal update and cabal install Cabal cabal-install again, just to update your Cabal installations in case it's old. Then remove your system-wide installed Cabal, and add ~/.cabal/bin to your path. You should now have cabal sandbox functionality working, install everything in sandboxes.

    UPDATE: If your package manager doesn't have GHC 7.8.3: Just install whatever version it has, and install Cabal and cabal-install as I described. Then remove package manager's GHC and install latest pre-compiled version from http://www.haskell.org/ghc/download_ghc_7_8_3.

    If you package manager's GHC is not new enough to compile latest Cabal and cabal-install, then you need to boot libraries, starting from older GHC and older Cabal and then updating GHC, installing newer Cabal using up-to-date GHC and older Cabal etc.

    Just don't install Haskell Platform, it's just not worth the pain.