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, reads .cabal files, and resolves from Hackage. The goal is to be GHC-compatible and drop-in for most packages, not to define a new language.
What BHC adds is choice about the runtime, and first-class support for targets GHC was never designed around.
Where they differ
| BHC | GHC | |
|---|---|---|
| Implementation | Clean-slate, in Rust | Decades-refined, in Haskell |
| Runtime | Selectable runtime profiles | One general-purpose RTS |
| WebAssembly | First-class (wasm32-wasi, SIMD128) | Experimental |
| GPU compute | CUDA / ROCm via numeric profile | — |
| Embedded / no-GC | Embedded profile, bare-metal targets | — |
| Realtime / bounded GC | Realtime profile | Best-effort |
| Ecosystem maturity | Young, opinionated | Battle-tested, vast |
| Template Haskell | Partial | Full |
Runtime profiles
This is the core idea. The same source compiles under different performance contracts, chosen with one flag:
- default — lazy, GC-managed, general purpose
- server — structured concurrency, observability, predictable latency
- numeric — strict-by-default, guaranteed fusion, SIMD, GPU
- edge — minimal runtime for WASM
- realtime — bounded GC pauses for games and audio
- embedded — no GC, bare-metal
hx build --compiler=bhc --profile=server. Same language, same guarantees, different envelope.
When to use which
Choose BHC if you need WebAssembly, GPU, or embedded targets as first-class citizens; guaranteed fusion and predictable numeric performance; structured concurrency; or bounded GC pauses for realtime work.
Choose GHC if you need maximum Hackage compatibility today, rely heavily on Template Haskell, or want decades of production stability. Many projects will use both — and because BHC compiles the same language, you can compile some modules with one and some with the other.