hx toolchain

Manage Haskell toolchains (GHC, Cabal, BHC).

Synopsis

hx toolchain <SUBCOMMAND> [OPTIONS]

Subcommands

SubcommandDescription
installInstall a toolchain version
removeRemove an installed version
listList installed versions
useSet active version
availableShow available versions

hx toolchain install

Install GHC, Cabal, or BHC.

Synopsis

hx toolchain install [OPTIONS]

Options

    --ghc <VERSION>     GHC version to install
    --cabal <VERSION>   Cabal version to install
    --bhc <VERSION>     BHC version to install
    --recommended       Install recommended versions
    --direct            Download directly (skip ghcup)
-v, --verbose           Show detailed output

Examples

# Install recommended versions
hx toolchain install

# Install specific GHC version
hx toolchain install --ghc 9.8.2

# Install GHC and Cabal together
hx toolchain install --ghc 9.8.2 --cabal 3.10.3.0

# Install BHC
hx toolchain install --bhc 0.2.0

# Direct download (without ghcup)
hx toolchain install --ghc 9.8.2 --direct

hx toolchain remove

Remove an installed toolchain version.

Synopsis

hx toolchain remove [OPTIONS]

Options

    --ghc <VERSION>     GHC version to remove
    --cabal <VERSION>   Cabal version to remove
    --bhc <VERSION>     BHC version to remove
    --all               Remove all versions

Examples

# Remove specific GHC version
hx toolchain remove --ghc 9.6.4

# Remove BHC
hx toolchain remove --bhc 0.1.0

hx toolchain list

List installed toolchain versions.

Synopsis

hx toolchain list [OPTIONS]

Options

    --ghc               Show only GHC versions
    --cabal             Show only Cabal versions
    --bhc               Show only BHC versions
    --json              Output as JSON

Examples

hx toolchain list

Output:

GHC versions:
  9.8.2 (active)
  9.6.4
  9.4.8

Cabal versions:
  3.10.3.0 (active)
  3.8.1.0

BHC versions:
  0.2.0 (active)

hx toolchain use

Set the active toolchain version.

Synopsis

hx toolchain use [OPTIONS]

Options

    --ghc <VERSION>     Set active GHC version
    --cabal <VERSION>   Set active Cabal version
    --bhc <VERSION>     Set active BHC version

Examples

# Set active GHC
hx toolchain use --ghc 9.8.2

# Set active BHC
hx toolchain use --bhc 0.2.0

hx toolchain available

Show versions available for installation.

Synopsis

hx toolchain available [OPTIONS]

Options

    --ghc               Show available GHC versions
    --cabal             Show available Cabal versions
    --bhc               Show available BHC versions
    --all               Show all available versions

Examples

# Show available GHC versions
hx toolchain available --ghc

Output:

Available GHC versions:
  9.10.1
  9.8.2 (recommended)
  9.8.1
  9.6.5
  9.6.4
  ...

Installation Methods

hx can install toolchains via:

GHCup (Default)

Uses ghcup if available:

hx toolchain install --ghc 9.8.2
# Runs: ghcup install ghc 9.8.2

Direct Download

Downloads binaries directly:

hx toolchain install --ghc 9.8.2 --direct

Benefits:

  • Works without ghcup
  • Faster in some cases
  • Supports custom install paths

Platform Support

GHC Platforms

PlatformArchitectureStatus
Linuxx86_64
Linuxaarch64
macOSx86_64
macOSaarch64
Windowsx86_64

BHC Platforms

PlatformArchitectureStatus
Linuxx86_64
Linuxaarch64
macOSx86_64
macOSaarch64

Installation Paths

GHCup Managed

~/.ghcup/ghc/<version>/
~/.ghcup/cabal/<version>/

Direct Install

~/.hx/toolchains/ghc-<version>/
~/.hx/toolchains/cabal-<version>/
~/.bhc/versions/<version>/

Project Toolchain

Pin toolchain in hx.toml:

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

hx automatically uses the correct version for each project.

See Also