Comparison

BHC vs GHC

GHC is one of the most sophisticated compilers ever built, and BHC does not try to replace it. BHC is a clean-slate compiler for the same language, making different tradeoffs for a different era.

They compile the same language

BHC, the Basel Haskell Compiler, is not a fork of GHC — it is a clean-slate compiler written in Rust. It compiles standard Haskell with the same type safety and aims to match GHC’s semantics; driven by hx, it reads .cabal files and resolves from Hackage. The goal is compatibility, not a new language. The proof point so far is Pandoc: BHC compiles all 221 of its modules to native code, and the resulting binary reads Markdown and writes HTML end to end.

What BHC adds is choice about the runtime, and first-class support for targets GHC was never designed around.

Where they differ

BHCGHC
ImplementationClean-slate, in RustDecades-refined, in Haskell
RuntimeSelectable runtime profilesOne general-purpose RTS
WebAssemblyNative backend for wasm32-wasi, compiling real programsExperimental
GPU computeMetal on Apple silicon runs today; CUDA / ROCm emitted, not yet hardware-tested—
Garbage collectionNot yet on the compiled-code pathMature generational GC
Ecosystem maturityYoung, opinionatedBattle-tested, vast
Template HaskellPartial (declaration splices such as makeLenses)Full

Runtime profiles

This is the core idea. The same source compiles under different performance contracts, chosen per package or per module. BHC has four:

  • default — lazy, general purpose, compatibility first
  • server — structured concurrency, observability, predictable latency
  • numeric — strict-by-default and unboxed, designed around guaranteed fusion
  • edge — minimal runtime footprint for WebAssembly and small targets

Realtime (bounded pauses) and embedded (no GC, bare metal) profiles are planned. The profile contracts are ahead of the code generator today: numeric fusion and server concurrency exist in the compiler and runtime but are not yet fully wired into native output.

With hx, pick BHC with hx build --backend bhc and set the profile in hx.toml under [compiler.bhc]. Same language, same guarantees, different envelope.

When to use which

Choose BHC if you want to follow a compiler built for WebAssembly and GPU targets, explicit runtime profiles and structured concurrency, and you are comfortable with a young toolchain that is still closing the gap between its design and its code generator.

Choose GHC if you need maximum Hackage compatibility today, rely heavily on Template Haskell, or want decades of production stability. Because BHC compiles the same language, the same project can be built with either, and hx switches between them with one flag.

Explore BHC → · Get started → · Why a new compiler →