BHC Platform

BHC Platform provides curated package snapshots for the BHC (Basel Haskell Compiler) backend — the BHC equivalent of Stackage.

Overview

When using the BHC backend, BHC Platform snapshots provide a set of packages verified to build and work together. This gives you reproducible builds without manually specifying version constraints for every dependency.

Quick Start

# List available snapshots
hx bhc-platform list

# Set a snapshot for your project
hx bhc-platform set bhc-platform-2026.1

# Lock dependencies using the snapshot
hx lock

Or configure directly in hx.toml:

[compiler]
backend = "bhc"

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

How It Works

  1. Embedded snapshots — BHC Platform data is embedded in hx, so no network fetch is required
  2. Version pinning — When you run hx lock, package versions from the snapshot are pinned in the resolver
  3. Lockfile recording — The lockfile records which snapshot was used for reproducibility
  4. Hackage fallback — Packages not in the snapshot can be resolved from Hackage if allow_newer = true

Available Snapshots

bhc-platform-2026.1

The initial BHC Platform snapshot:

  • BHC version: 0.1.0
  • GHC compatibility: 9.8.2
  • Packages: ~70

Covers the core Haskell ecosystem plus specialized packages for web, numeric, and server workloads:

CategoryPackages
Corebase, ghc-prim, integer-gmp, template-haskell
Text & ByteStringtext, bytestring, utf8-string
Containerscontainers, unordered-containers, hashable, vector
Transformersmtl, transformers, exceptions, unliftio
Serializationaeson, yaml, binary, cereal
Opticslens, microlens, generic-lens
Parsingmegaparsec, attoparsec, optparse-applicative
HTTP & Webhttp-client, http-types, servant, servant-server, warp, wai, wai-extra
Databasepersistent, esqueleto, resource-pool
Numerichmatrix, statistics, massiv, random
Testinghspec, QuickCheck, tasty, hedgehog, hspec-wai
Streamingconduit, streaming, pipes
CLI & Loggingoptparse-applicative, monad-logger, fast-logger, co-log

Configuration

Basic

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

With Extra Dependencies

Allow packages outside the snapshot and override specific versions:

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

Fields

FieldTypeDefaultDescription
snapshotstringnoneSnapshot identifier (e.g., bhc-platform-2026.1)
allow_newerboolfalseAllow packages from Hackage outside the snapshot
extra_depstable{}Override specific package versions

BHC Platform vs Stackage

FeatureBHC PlatformStackage
ForBHC backendGHC backend
DeliveryEmbedded in hxFetched from stackage.org
Package count~70 (curated)~3000+
OfflineYesAfter first fetch
Configuration[bhc-platform][toolchain].resolver

Use BHC Platform when [compiler].backend = "bhc". Use Stackage when using GHC.

Project Templates

The numeric and server project templates come pre-configured with BHC Platform:

# Numeric computing project
hx new numeric my-science
# → backend = "bhc", profile = "numeric", snapshot = pre-configured

# Web server project
hx new server my-api
# → backend = "bhc", profile = "server", snapshot = pre-configured

CLI Commands

CommandDescription
hx bhc-platform listList available snapshots
hx bhc-platform info <platform>Show snapshot details
hx bhc-platform info <platform> --packagesShow all packages
hx bhc-platform set <platform>Set snapshot in hx.toml

See hx bhc-platform for the full command reference.

Troubleshooting

Package not in snapshot

error: Could not resolve dependency: some-package

Set allow_newer = true in [bhc-platform] to allow resolving from Hackage, or add the package to extra_deps.

BHC not installed

error: BHC is not installed

Install BHC with hx toolchain install --bhc latest.

Using with GHC backend

BHC Platform snapshots are only applied when [compiler].backend = "bhc". If you’re using GHC, configure a Stackage resolver instead.

See Also