hx is a modern toolchain CLI for Haskell, written in Rust. It wraps existing tools (GHC, Cabal, GHCup, HLS) in a fast, unified interface with excellent error messages and deterministic builds.
Features
- Fast feedback loop - Common workflows are snappy with parallel builds
- Deterministic builds - Lockfile + frozen plans for reproducibility
- Native builds - Direct GHC invocation without cabal for simple projects
- Excellent errors - Actionable messages with fix suggestions
- Watch mode - Auto-rebuild on file changes
- Test coverage - Integrated hpc support with HTML reports
- Plugin system - Extensible with Steel (Scheme) scripts
- Self-contained - Manages GHC versions directly, no ghcup required
- BHC backend - Optional Basel Haskell Compiler backend with curated BHC Platform snapshots
Installation
From releases
# macOS/Linux
|
# Or download from releases
Windows
winget install raskell-io.hx
From source
Verify installation
Quick Start
# Create a new project
# Build and run
# Lock dependencies for reproducibility
# Watch for changes
Commands
Project Management
Building
Running & Testing
Watch Mode
Dependencies
Code Quality
Test Coverage
Profiling
Documentation
Toolchain Management
IDE Integration
Publishing
Distribution
Utilities
Cache Management
Plugins
Project-local plugins (.hx/plugins/*.scm) only run after you trust the
project with hx plugins trust - cloning a repository never grants its
scripts execution rights.
Configuration
hx uses hx.toml for project configuration:
[]
= "myapp"
= "bin" # or "lib"
= "cabal"
[]
= "9.8.2"
= "3.12.1.0"
= "2.9.0.0"
[]
= 2 # 0, 1, or 2
= true
= false # Use native GHC builds
[]
= "fourmolu"
[]
= true
[]
= true
= 30000
[]
= ["./scripts/check.scm"]
= ["./scripts/notify.scm"]
Global Configuration
hx supports global configuration at ~/.config/hx/config.toml (Linux), ~/Library/Application Support/hx/config.toml (macOS), or %APPDATA%\hx\config\config.toml (Windows).
Global settings provide defaults that can be overridden by project-local hx.toml:
# ~/.config/hx/config.toml
[]
= "9.8.2"
= "3.12.1.0"
[]
= 1
= true
[]
= "fourmolu"
[]
= true
Managing Global Config
# Examples:
Lockfile
The hx.lock file ensures reproducible builds:
= 1
= "2026-01-16T00:00:00Z"
[]
= "9.8.2"
= "3.12.1.0"
[]
= "ghc-9.8.2"
= "x86_64-linux"
= "sha256:..."
[[]]
= "text"
= "2.1.1"
Environment Variables
| Variable | Description |
|---|---|
HX_VERBOSE |
Enable verbose output |
HX_QUIET |
Suppress output |
HX_NO_COLOR |
Disable colored output |
HX_CONFIG_FILE |
Path to config file |
HX_CACHE_DIR |
Cache directory location |
HX_AUTO_INSTALL |
Auto-install missing toolchains |
HX_NO_AUTO_INSTALL |
Never auto-install toolchains |
HX_ALLOW_UNVERIFIED_DOWNLOADS |
Allow toolchain installs without a published checksum |
HX_BHC_PLATFORM_PUBKEY |
Pinned Ed25519 key for BHC Platform snapshot verification |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Usage error |
| 3 | Configuration error |
| 4 | Toolchain error |
| 5 | Build/test failure |
| 6 | Plugin hook failure |
Architecture
hx is a Rust workspace with these crates:
| Crate | Purpose |
|---|---|
hx-cli |
Command-line interface |
hx-core |
Shared types and utilities |
hx-config |
Configuration parsing |
hx-lock |
Lockfile management |
hx-toolchain |
GHC/Cabal detection and installation |
hx-cabal |
Cabal wrapper and native builds |
hx-cache |
Build cache management |
hx-doctor |
Diagnostic checks |
hx-solver |
Native dependency resolver |
hx-lsp |
Language server protocol |
hx-plugins |
Steel plugin runtime |
hx-ui |
Terminal output utilities |
hx-warnings |
Warning system |
hx-telemetry |
Tracing and metrics |
hx-compiler |
Compiler backend abstraction (GHC, BHC) |
hx-bhc |
BHC (Basel Haskell Compiler) native build pipeline |
Development
# Build
# Run tests
# Run clippy
# Format
# Run hx locally
Philosophy
hx follows the Astral approach:
- Wrap first - Use existing tools (Cabal, GHC) rather than reimplementing
- Tame second - Add better UX, error messages, and workflows
- Replace last - Only replace components when truly necessary (native builds)
License
MIT