hx.toml Reference

Complete reference for the hx.toml configuration file.

Overview

hx.toml is the main configuration file for hx projects. It uses the TOML format and lives in your project root.

[project]

Project metadata.

[project]
name = "my-project"           # Package name
version = "0.1.0"             # Package version
description = "My library"    # Short description
license = "MIT"               # SPDX license identifier
authors = ["Your Name <you@example.com>"]
repository = "https://github.com/user/project"
homepage = "https://project.example.com"

Fields

FieldTypeDescription
namestringPackage name (must match .cabal)
versionstringSemantic version
descriptionstringShort description
licensestringSPDX license identifier
authorsarrayList of authors
repositorystringRepository URL
homepagestringProject homepage URL

[toolchain]

Toolchain version pinning.

[toolchain]
ghc = "9.8.2"                 # GHC version
cabal = "3.10.3.0"            # Cabal version (optional)
resolver = "lts-22.0"         # Stackage resolver (optional)

Fields

FieldTypeDescription
ghcstringRequired GHC version
cabalstringRequired Cabal version
resolverstringStackage resolver name

Examples

# Pin exact GHC version
[toolchain]
ghc = "9.8.2"

# Pin both GHC and Cabal
[toolchain]
ghc = "9.8.2"
cabal = "3.10.3.0"

# Use Stackage resolver
[toolchain]
resolver = "lts-22.0"

[compiler]

Compiler backend configuration.

[compiler]
backend = "ghc"               # "ghc" or "bhc"
version = "9.8.2"             # Compiler version (overrides toolchain)

Fields

FieldTypeDescription
backendstringCompiler backend: "ghc" (default) or "bhc"
versionstringCompiler version

[compiler.ghc]

GHC-specific configuration.

[compiler.ghc]
version = "9.8.2"             # GHC version
options = ["-Wall"]           # Default GHC options

[compiler.bhc]

BHC (Basel Haskell Compiler) configuration.

[compiler.bhc]
profile = "numeric"           # "default", "server", "numeric", "edge"
emit_kernel_report = false    # Generate kernel optimization report
tensor_fusion = false         # Enable tensor fusion optimization
target = "aarch64-linux-gnu"  # Cross-compilation target

BHC Profiles

ProfileDescription
defaultBalanced for general use
serverOptimized for server workloads
numericOptimized for numerical computation
edgeOptimized for edge/embedded devices

Examples

# Use GHC (default)
[compiler]
backend = "ghc"

# Use BHC with numeric optimizations
[compiler]
backend = "bhc"

[compiler.bhc]
profile = "numeric"
tensor_fusion = true

[bhc-platform]

BHC Platform curated snapshot configuration. This is the BHC equivalent of Stackage — a curated set of packages verified to build together under BHC.

[bhc-platform]
snapshot = "bhc-platform-2026.1"   # Curated package set
allow_newer = false                # Allow packages outside the snapshot
extra_deps = {}                    # Override specific package versions

Fields

FieldTypeDefaultDescription
snapshotstringnoneBHC Platform snapshot identifier
allow_newerboolfalseAllow packages from Hackage outside the snapshot
extra_depstable{}Override specific package versions

Examples

# Use a BHC Platform snapshot
[compiler]
backend = "bhc"

[bhc-platform]
snapshot = "bhc-platform-2026.1"

# With overrides
[bhc-platform]
snapshot = "bhc-platform-2026.1"
allow_newer = true
extra_deps = { my-custom-lib = "1.0.0" }

Note: BHC Platform snapshots are only applied when [compiler].backend = "bhc". For GHC projects, use Stackage snapshots via [toolchain].resolver.

See hx bhc-platform for CLI commands.

[build]

Build configuration.

[build]
release = false               # Build with optimizations by default
jobs = 4                      # Parallel jobs (0 = auto)
ghc-options = ["-Wall", "-Wextra"]
split-sections = false        # Enable split sections (smaller binaries)
incremental = true            # Enable incremental builds

Fields

FieldTypeDefaultDescription
releaseboolfalseBuild with optimizations
jobsintCPU countParallel compilation jobs
ghc-optionsarray[]Options passed to GHC
split-sectionsboolfalseEnable -split-sections
incrementalbooltrueEnable incremental builds

Examples

# Development defaults
[build]
release = false
ghc-options = ["-Wall", "-Wcompat"]

# Production build
[build]
release = true
ghc-options = ["-Wall", "-Werror", "-O2"]
split-sections = true

# Fast iteration
[build]
jobs = 0
incremental = true

[test]

Test configuration.

[test]
default-suite = "unit-tests"  # Default test suite to run
fail-fast = false             # Stop on first failure
show-timing = true            # Show test timing
coverage = false              # Generate coverage report

Fields

FieldTypeDefaultDescription
default-suitestringallDefault test suite
fail-fastboolfalseStop on first failure
show-timingbooltrueDisplay timing info
coverageboolfalseGenerate coverage

[test.coverage]

Coverage configuration.

[test.coverage]
enabled = false
output-dir = "coverage"
exclude = ["generated/**"]

[bench]

Benchmark configuration.

[bench]
default-suite = "criterion"   # Default benchmark suite
release = true                # Always build with optimizations

Fields

FieldTypeDefaultDescription
default-suitestringallDefault benchmark suite
releasebooltrueBuild with optimizations

[run]

Run configuration.

[run]
default-exe = "my-app"        # Default executable
args = []                     # Default arguments

Fields

FieldTypeDefaultDescription
default-exestringautoDefault executable to run
argsarray[]Default program arguments

[repl]

REPL configuration.

[repl]
default = "lib"               # Default component: lib, exe:name, test:name
auto-load = ["MyProject"]     # Modules to load on start
ghci-options = ["-XOverloadedStrings"]
ghci-conf = ".ghci"           # Custom .ghci file

Fields

FieldTypeDefaultDescription
defaultstring"lib"Default component to load
auto-loadarray[]Modules to import
ghci-optionsarray[]GHCi options
ghci-confstring.ghciGHCi config file

[doc]

Documentation configuration.

[doc]
internal = false              # Include internal modules
haddock-options = ["--hyperlinked-source"]
output-dir = "docs"           # Output directory

Fields

FieldTypeDefaultDescription
internalboolfalseDocument internal modules
haddock-optionsarray[]Haddock options
output-dirstringdefaultDocumentation output

[fmt]

Code formatting configuration.

[fmt]
formatter = "ormolu"          # "ormolu", "fourmolu", "stylish"
check = false                 # Check only, don't modify
exclude = ["generated/**"]    # Patterns to exclude

Fields

FieldTypeDefaultDescription
formatterstring"ormolu"Formatter to use
checkboolfalseCheck-only mode
excludearray[]Excluded patterns

[lint]

Linter configuration.

[lint]
extra-hints = [".hlint.yaml"] # Additional hint files
ignore = ["Eta reduce"]       # Ignored hints

Fields

FieldTypeDefaultDescription
extra-hintsarray[]Additional hint files
ignorearray[]Ignored hints

[watch]

Watch mode configuration.

[watch]
clear = true                  # Clear terminal on rebuild
debounce = 300                # Debounce delay (ms)
include = ["config/**"]       # Additional patterns to watch
exclude = ["dist-newstyle/**"] # Patterns to exclude

Fields

FieldTypeDefaultDescription
clearboolfalseClear terminal
debounceint300Debounce delay in ms
includearray[]Additional watch patterns
excludearray[]Excluded patterns

[dependencies]

Dependency management configuration.

[dependencies]
lock-strategy = "hx"          # "hx" or "cabal-freeze"
index-state = "2024-01-15T00:00:00Z"

Fields

FieldTypeDefaultDescription
lock-strategystring"hx"Lockfile strategy
index-statestringnoneHackage index state

Complete Example

[project]
name = "my-app"
version = "1.0.0"
description = "My awesome Haskell application"
license = "MIT"
authors = ["Developer <dev@example.com>"]
repository = "https://github.com/example/my-app"

[toolchain]
ghc = "9.8.2"
cabal = "3.10.3.0"

[compiler]
backend = "ghc"

[compiler.ghc]
options = ["-Wall", "-Wextra", "-Wcompat"]

[build]
release = false
jobs = 4
split-sections = true

[test]
fail-fast = true
show-timing = true

[test.coverage]
enabled = true
output-dir = "coverage"

[run]
default-exe = "my-app"
args = ["--verbose"]

[repl]
auto-load = ["MyApp", "MyApp.Config"]
ghci-options = ["-XOverloadedStrings"]

[fmt]
formatter = "fourmolu"
exclude = ["generated/**"]

[lint]
ignore = ["Use camelCase"]

[watch]
clear = true
debounce = 200
exclude = [".git/**", "dist-newstyle/**"]

[dependencies]
lock-strategy = "hx"

Complete BHC Example

[project]
name = "ml-pipeline"
version = "0.1.0"

[compiler]
backend = "bhc"

[compiler.bhc]
profile = "numeric"
tensor_fusion = true

[bhc-platform]
snapshot = "bhc-platform-2026.1"

[build]
release = true

[test]
fail-fast = true