This is notes for me to remember how to use GHC and Cabal to install and remove stuff I install.
I know nothing about Haskell, but so far, after going through pages, I think it’s safe to say there is no such thing in Haskell world as package management, at least for GHC (Glasgow Haskell Compiler). You can install package using Cabal, but uninstall is a pain-in-the-ass, I thought Perl is annoying.
You can --unregister a package with ghc-pkg — library package, not one installs executable — but none of the actual library files are removed, you have to manually remove them or find some scripts to help you. And there is no --uninstall in Cabal, even it does install package for you.
Both ghc-pkg and Cabal are simply not package managers.
So, if your system package manager has Haskell packages, use it to install and uninstall system-wide. If you insist to install at user home or other places, then use Cabal sandbox. Or you can just remove the ~/.ghc and ~/.cabal once they have got too many junks, and start over.
% SANDBOX=/path/to/somewhere % export PATH="$SANDBOX/.cabal-sandbox/bin:$PATH" % mkdir -p "$SANDBOX" % cd "$SANDBOX" % cabal sandbox init % cabal install <package|path> % <command>
I would suggestion just cd /tmp and use there as sandbox location. It will work well with uninstalling, that is to sandbox delete on /tmp. And if you use tmpfs on /tmp, you don’t even need to bother cleaning up..
% rm -rf "$SANDBOX" # cd "$SANDBOX" && cabal sandbox delete # $SANDBOX still exists