Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Created March 3, 2012 22:55
Show Gist options
  • Save pbrisbin/1968825 to your computer and use it in GitHub Desktop.
Save pbrisbin/1968825 to your computer and use it in GitHub Desktop.
ghc-pkg-clean() {
_have ghc-pkg || return 1
while read -r pkg; do
echo "attempting to unregister $pkg..."
ghc-pkg $* unregister $pkg
done <(ghc-pkg $* check |& sed '/^There are problems in package \([^:]*\):$/!d; s//\1/')
}
ghc-pkg-reset() {
read -p 'Are you sure (y/n)? ' ans
if [[ "$ans" =~ y*|Y* ]]; then
rm -rf "$HOME/.cabal/packages"/*/*
rm -rf "$HOME/.cabal/bin"/*
rm -rf "$HOME/.ghc"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment