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