Turbo Haskell
12 hours ago
- THC (Turbo Haskell Compiler) is a JIT compiler for GHC Core that runs Haskell on the JVM using Truffle and GraalVM, implementing all GHC 9.14.1 prim-ops.
- It supports advanced language features like Template Haskell and Linear Haskell, and can produce executables via ahead-of-time (AOT) compilation with Native Image.
- THC can JIT- or AOT-compile large Haskell programs such as pandoc, happy, alex, and even GHC itself.
- It provides polyglot FFI to Python, Ruby, R, and JavaScript, enabling zero-copy conversion of Data.Text to and from Truffle strings.
- Supports two Truffle evaluation backends (bytecode-based and AST-based), multi-threading, async exceptions, and lightweight green threading via Project Loom.
- SIMD support uses GHC prim-ops and the Vector API for runtime selection of SIMD width and loop JIT compilation.
- Tail call optimization uses Bloom filters and code transformation to turn hot tail calls into tight loops, with fallback to stack unwinding.
- Performance is comparable to GHC (10–20% slower after warmup on some benchmarks), though recent broad coverage has caused regressions.
- Development is open-source on GitHub (github.com/ekmett/thc) with IRC channel ##thc on libera.chat.