-
Notifications
You must be signed in to change notification settings - Fork 0
/
_ghcPkgUtils.source
25 lines (22 loc) · 1.07 KB
/
_ghcPkgUtils.source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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.
function ghc-pkg-reset() {
if [[ $(readlink -f /proc/$$/exe) =~ zsh ]]; then
read 'ans?Erasing all your user ghc and cabal packages - are you sure (y/N)? '
else # assume bash/bash compatible otherwise
read -p 'Erasing all your user ghc and cabal packages - are you sure (y/N)? ' ans
fi
[[ x$ans =~ "xy" ]] && ( \
echo 'erasing directories under ~/.ghc'; command rm -rf `find ~/.ghc/* -maxdepth 1 -type d`; \
echo 'erasing ~/.cabal/lib'; command rm -rf ~/.cabal/lib; \
)
}
alias cabalupgrades="cabal list --installed | egrep -iv '(synopsis|homepage|license)'"