ghc-clean-pkgs 2.0 KB

123456789101112131415161718192021222324
  1. # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
  2. # ghc-pkg-clean -f cabal/dev/packages*.conf also works.
  3. function ghc-pkg-clean() {
  4. for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
  5. do
  6. echo unregistering $p; ghc-pkg $* unregister $p
  7. done
  8. }
  9. # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
  10. # When all else fails, use this to get out of dependency hell and start over.
  11. function ghc-pkg-reset() {
  12. read -p 'erasing all your user ghc and cabal packages - are you sure (y/n) ? ' ans
  13. test x$ans == xy && ( \
  14. echo 'erasing directories under ~/.ghc'; rm -rf `find ~/.ghc -maxdepth 1 -type d`; \
  15. echo 'erasing ~/.cabal/lib'; rm -rf ~/.cabal/lib; \
  16. # echo 'erasing ~/.cabal/packages'; rm -rf ~/.cabal/packages; \
  17. # echo 'erasing ~/.cabal/share'; rm -rf ~/.cabal/share; \
  18. )
  19. }
  20. alias cabalupgrades="cabal list --installed | egrep -iv '(synopsis|homepage|license)'"
  21. ghc-pkg-clean