function cabal() (
if [ "$1" = "install" ]; then
out=$(command cabal --dry-run -v2 "$@" 2>&1)
if echo "$out" | egrep -c '\((reinstall|new version)\)' >/dev/null; then
echo "$out"
echo "
[NOTE] To proceed with installation, possibly breaking packages above, run
[NOTE] > command cabal $*"
return 1
fi
fi
command cabal "$@"
)