Skip to content

Instantly share code, notes, and snippets.

@simonmichael
Created September 1, 2011 03:59
Show Gist options
  • Save simonmichael/1185421 to your computer and use it in GitHub Desktop.
Save simonmichael/1185421 to your computer and use it in GitHub Desktop.

Revisions

  1. simonmichael revised this gist Oct 10, 2011. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,22 @@
    # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
    # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
    # ghc-pkg-clean -f cabal/dev/packages*.conf also works.
    function ghc-pkg-clean() {
    for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
    do
    echo unregistering $p; ghc-pkg $* unregister $p
    done
    }

    # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
    # When all else fails, use this to get out of dependency hell and start over.
    # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
    # When all else fails, use this to get out of dependency hell and start over.
    function ghc-pkg-reset() {
    read -p 'erasing all your user ghc and cabal packages - are you sure (y/n) ? ' ans
    test x$ans == xy && ( \
    echo 'erasing directories under ~/.ghc'; rm -rf `find ~/.ghc -type d -depth 1`; \
    echo 'erasing directories under ~/.ghc'; rm -rf `find ~/.ghc -maxdepth 1 -type d`; \
    echo 'erasing ~/.cabal/lib'; rm -rf ~/.cabal/lib; \
    # echo 'erasing ~/.cabal/packages'; rm -rf ~/.cabal/packages; \
    # echo 'erasing ~/.cabal/share'; rm -rf ~/.cabal/share; \
    # echo 'erasing ~/.cabal/packages'; rm -rf ~/.cabal/packages; \
    # echo 'erasing ~/.cabal/share'; rm -rf ~/.cabal/share; \
    )
    }

    alias cabalupgrades="cabal list --installed | egrep -iv '(synopsis|homepage|license)'"
  2. simonmichael renamed this gist Sep 15, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. simonmichael created this gist Sep 1, 2011.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
    function ghc-pkg-clean() {
    for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
    do
    echo unregistering $p; ghc-pkg $* unregister $p
    done
    }

    # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
    # When all else fails, use this to get out of dependency hell and start over.
    function ghc-pkg-reset() {
    read -p 'erasing all your user ghc and cabal packages - are you sure (y/n) ? ' ans
    test x$ans == xy && ( \
    echo 'erasing directories under ~/.ghc'; rm -rf `find ~/.ghc -type d -depth 1`; \
    echo 'erasing ~/.cabal/lib'; rm -rf ~/.cabal/lib; \
    # echo 'erasing ~/.cabal/packages'; rm -rf ~/.cabal/packages; \
    # echo 'erasing ~/.cabal/share'; rm -rf ~/.cabal/share; \
    )
    }