Clean and reinstall those GHC packages!
November 18, 2011
For those of you who are as lazy as me about fixing and reinstalling broken GHC packages, I’ve ripped off the well-known and loved ghc-pkg-clean script and made it recursive. No promises of termination:
function ghc-pkg-supercleaner() {
b="0"
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p;
cabal install $p; b="1"
done
if [ $b == "1" ];
then ghc-pkg-supercleaner
fi
}
November 18, 2011 at 8:08 pm
For me, it gets stuck in an endless loop recompiling the text package over and over.
November 18, 2011 at 8:22 pm
Not entirely surprising. It has worked well for me but I figure I’ll eventually hit a non-terminating case. Hence the disclaimer!
November 21, 2011 at 1:52 am
Have you tried cab? It can do recursive removal of packages.
Hopefully the next version of cabal-install should prevent package breaking by default.