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.

    • 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!

  2. 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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: