Update dependencies to newer versions.
Synopsis
hx update [PACKAGES]... [OPTIONS]Description
The update command updates dependencies to their latest compatible versions. Without arguments, it updates all dependencies. With package names, it updates only those packages.
Arguments
PACKAGES... Specific packages to update (optional)Options
--all Update all dependencies
--major Allow major version updates
--patch Only patch version updates
--dry-run Show what would be updated
-v, --verbose Show detailed outputExamples
Update All Dependencies
hx updateUpdate Specific Packages
hx update aeson textPreview Updates
hx update --dry-runOutput:
Would update:
aeson: 2.1.0.0 -> 2.2.0.0
text: 2.0.1 -> 2.1
containers: 0.6.7 -> 0.6.8Allow Major Updates
# By default, respects version constraints in .cabal
# Use --major to allow breaking changes
hx update --major aesonPatch Updates Only
# Only update patch versions (safest)
hx update --patchUpdate Strategies
Default (Minor)
Updates within version constraints:
aeson ^>=2.1 allows 2.1.0.0 -> 2.1.2.0
aeson ^>=2.1 blocks 2.1.0.0 -> 2.2.0.0Patch Only
Only bug fixes:
aeson 2.1.0.0 -> 2.1.0.1 ✓
aeson 2.1.0.0 -> 2.1.1.0 ✗Major
Allows breaking changes:
aeson 2.1.0.0 -> 3.0.0.0 ✓Also updates constraints in .cabal:
# Before
build-depends: aeson ^>=2.1
# After --major
build-depends: aeson ^>=3.0What It Does
- Checks for updates on Hackage
- Resolves compatible versions with solver
- Updates lockfile with new versions
- Optionally updates .cabal constraints
Package Index
Update the Hackage package index first:
# Update package index
cabal update
# Then update dependencies
hx updateSelective Updates
Update only what you need:
# Update just aeson
hx update aeson
# Update text ecosystem
hx update text text-show text-builder
# Update all test dependencies
hx update hspec QuickCheck tastyAfter Updating
After updating dependencies:
# Build to verify
hx build
# Run tests
hx test
# Commit changes
git add hx.lock *.cabal
git commit -m "Update dependencies"Troubleshooting
Solver Failures
If update fails due to conflicts:
# See what's conflicting
hx update --verbose
# Try updating one at a time
hx update aeson
hx update textRollback
If an update breaks your build:
# Restore previous lockfile
git checkout hx.lock
# Sync dependencies
hx syncSee Also
- hx add — Add dependencies
- hx outdated — Check for outdated deps
- hx lock — Generate lockfile