Remove dependencies from your project.
Synopsis
hx remove <PACKAGES>... [OPTIONS]Description
The remove command removes one or more package dependencies from your project. It updates your .cabal file and optionally updates the lockfile.
Arguments
PACKAGES... Package names to removeOptions
--all Remove from all components
--lib Remove from library only
--exe <NAME> Remove from specific executable
--test <NAME> Remove from specific test suite
--bench <NAME> Remove from specific benchmark
--no-lock Don't update lockfile
-v, --verbose Show detailed outputExamples
Remove Single Package
hx remove textRemove Multiple Packages
hx remove text containers aesonRemove from All Components
hx remove --all textRemove from Specific Component
# Remove from library only
hx remove --lib text
# Remove from specific executable
hx remove --exe my-cli optparse-applicative
# Remove from test suite
hx remove --test unit-tests hspecWhat It Does
Removes from .cabal file
- Updates build-depends for specified components
- Preserves other configuration
Updates lockfile (unless
--no-lock)- Removes unused transitive dependencies
Before
library
build-depends:
, base ^>=4.18
, containers
, textAfter hx remove text
library
build-depends:
, base ^>=4.18
, containersSafety Checks
hx warns if:
- Package is still used in source files
- Other packages depend on it
- Package is not found in dependencies
$ hx remove text
warning: 'text' may still be used in:
- src/MyLib.hs (line 5)
Continue anyway? [y/N]Use --force to skip confirmation:
hx remove --force textCleanup
After removing dependencies, you may want to:
# Update lockfile
hx lock
# Clean build artifacts
hx clean
# Rebuild
hx buildSee Also
- hx add — Add dependencies
- hx update — Update dependencies
- hx outdated — Check for outdated dependencies