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 }