A next-generation Haskell compiler and runtime for 2026: predictable performance, structured concurrency, and a tensor-native numeric pipeline.
BHC is a clean-slate Haskell compiler and runtime built to remain compatible with the spirit of Haskell while introducing modern profiles, a standardized runtime contract, and a tensor-native compilation pipeline.
BHC is named after Basel, Switzerland — as a deliberate successor culture to the Glasgow Haskell Compiler lineage, with a new focus on predictability, concurrency, and numerical computing.
BHC prioritizes predictability over folklore: if performance matters, the compiler tells you what happened. If concurrency matters, cancellation is structured. If numerics matter, fusion is guaranteed and kernels are traceable.
BHC supports multiple compilation profiles with distinct performance contracts:
| Profile | Use Case | Key Characteristics |
|---|---|---|
| Default | General Haskell | Lazy evaluation, GC managed |
| Server | Web services, daemons | Concurrency, bounded latency, observability |
| Numeric | ML, linear algebra, tensors | Strict-by-default, unboxed, fusion guaranteed |
| Edge | Embedded, WASM | Minimal runtime footprint |
- Strict-by-default in Numeric Profile — no hidden thunks
- Guaranteed fusion for standard patterns (
map,zipWith,fold) - Tensor IR with shape/stride tracking for optimal code generation
- SIMD auto-vectorization for modern CPUs
- Parallel primitives with deterministic scheduling
- Scoped task spawning with automatic cleanup
- Cooperative cancellation with propagation
- Deadline and timeout support
- Event tracing for observability
- Hot Arena — Bump allocation for loop temporaries
- Pinned Heap — Non-moving memory for FFI/DMA
- General Heap — GC-managed allocations
BHC targets the Haskell 2026 Platform specification:
- H26-Core — Language core + minimal runtime contract
- H26-Platform — Core + standard libraries + packaging
- H26-Numeric — Platform + Numeric Profile + Tensor IR guarantees
| Command | Description |
|---|---|
bhc |
Compiler driver |
bhci |
Interactive REPL |
bhi |
IR inspector / kernel reports |
# Build the compiler
cargo build --release
# Compile a program
./target/release/bhc hello.hs -o hello
# Run with Numeric Profile
./target/release/bhc --profile=numeric matmul.hs -o matmul
# View kernel fusion report
./target/release/bhc --profile=numeric --kernel-report tensor_ops.hs
# Try it in your browser
# Visit https://bhc.raskell.io/playground/{-# HASKELL_EDITION 2026 #-}
{-# PROFILE Numeric #-}
module Main where
import H26.Tensor
-- Dot product: guaranteed to fuse into single loop
dot :: Tensor Float -> Tensor Float -> Float
dot xs ys = sum (zipWith (*) xs ys)
-- Matrix multiply: auto-vectorized, parallel
matmul :: Tensor Float -> Tensor Float -> Tensor Float
matmul a b = parMap (\i ->
parMap (\j -> dot (row i a) (col j b)) [0..n-1]
) [0..m-1]
where
(m, _) = shape a
(_, n) = shape b
main :: IO ()
main = do
let a = fromList [2, 3] [1, 2, 3, 4, 5, 6]
b = fromList [3, 2] [1, 2, 3, 4, 5, 6]
c = matmul a b
print cbhc/
├── crates/ # Rust compiler implementation
│ ├── bhc/ # Main CLI binary
│ ├── bhc-driver/ # Compilation orchestration
│ ├── bhc-parser/ # Parsing (lexer, AST)
│ ├── bhc-typeck/ # Type inference & checking
│ ├── bhc-core/ # Core IR + interpreter
│ ├── bhc-tensor-ir/ # Tensor IR (Numeric profile)
│ ├── bhc-loop-ir/ # Loop IR (vectorization)
│ ├── bhc-codegen/ # Native code generation (LLVM)
│ ├── bhc-wasm/ # WebAssembly backend
│ ├── bhc-gpu/ # GPU backends (CUDA/ROCm)
│ └── bhc-playground/ # Browser WASM playground
├── rts/ # Runtime system (Rust)
│ ├── bhc-rts/ # Core runtime
│ └── bhc-rts-gc/ # Garbage collector
├── stdlib/ # Standard library
│ ├── bhc-prelude/ # Prelude primitives
│ ├── bhc-base/ # Base library
│ ├── bhc-containers/ # Data structures
│ ├── bhc-numeric/ # Numeric/SIMD/BLAS
│ └── H26/ # H26 Platform modules
├── tools/ # Additional tools
│ ├── bhci/ # Interactive REPL
│ ├── bhi/ # IR inspector
│ └── bhc-docs/ # Documentation generator
└── tests/ # Test suites
| Milestone | Name | Status |
|---|---|---|
| Phase 1 | Native Hello World | ✅ Complete |
| Phase 2 | Language Completeness | ✅ Complete |
| Phase 3 | Numeric Profile | ✅ Complete |
| Phase 4 | WASM Backend | 🟡 70% |
| Phase 5 | Server Profile | ✅ Complete |
| Phase 6 | GPU Backend | 🟡 80% |
See ROADMAP.md for detailed milestone specifications.
- Website — Official website with guides and tutorials
- API Docs — Standard library reference (63 modules)
- Playground — Try BHC in your browser
- ROADMAP.md — Implementation status and milestones
- .claude/CLAUDE.md — Development guidelines
- Rust 1.75+ (stable toolchain)
- LLVM 17+ (for native codegen)
- wasm32-unknown-unknown target (for playground)
# Build everything
cargo build
# Build release
cargo build --release
# Run tests
cargo test
# Run specific crate tests
cargo test -p bhc-parser
# Run benchmarks
cargo bench
# Build and run bhc
cargo run --bin bhc -- Main.hsContributions are welcome. Please read the guidelines in .claude/rules/ before submitting changes.
Use conventional commits:
feat:New featuresfix:Bug fixesperf:Performance improvementsrefactor:Code restructuringdocs:Documentationtest:Test additions/changes
BSD-3-Clause
BHC builds on decades of research in functional programming, type systems, and compiler construction. We acknowledge the foundational work of the GHC team and the broader Haskell community.