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() {
    for p in `ghc-pkg check $* 2>&1  | grep problems | awk '{print $6}' | sed -e 's/:$//'`
        echo unregistering $p; ghc-pkg $* unregister $p;
        cabal install $p; b="1"
    if [ $b == "1" ];
      then ghc-pkg-supercleaner

3 Responses to “Clean and reinstall those GHC packages!”

  1. For me, it gets stuck in an endless loop recompiling the text package over and over.

  2. tommd Says:

    Not entirely surprising. It has worked well for me but I figure I’ll eventually hit a non-terminating case. Hence the disclaimer!

  3. Jens Petersen Says:

    Have you tried cab? It can do recursive removal of packages.

    Hopefully the next version of cabal-install should prevent package breaking by default.

Comments are closed.

%d bloggers like this: