hn.today

Turbo Haskell

comonad.com12 points2 comments
Screenshot of Turbo Haskell

Turbo Haskell (THC) is a JIT/AOT system that runs GHC Core on the JVM via Truffle and GraalVM, implementing the full set of GHC 9.14.1 prim-ops and delegating parsing, typechecking, desugaring and Core optimizations to GHC. It supports advanced Haskell features such as Template Haskell, Linear Haskell, Backpack and Cabal package resolution, and can produce native executables via GraalVM Native Image. THC already runs substantial codebases - pandoc, happy, alex and even GHC itself - and provides polyglot FFIs to Python, Ruby, R and JavaScript with zero-copy UTF-8 Text conversions; C/C++ is handled through Sulong (native- and managed-mode options).

The runtime exposes two Truffle backends (bytecode and AST), supports GHC-style concurrency primitives including throwTo, async exceptions and masking, and can use plain Java threads or Project Loom to provide lightweight green threads and cheap MVars via an HEC-style executor. SIMD is handled with runtime-selected vector “species” through the incubating Vector API, and hot tail calls are transformed into tight loops using tracing heuristics (a 64-bit Bloom filter), slow-path exceptions and Truffle/Graal loop transformations, with a stack-compaction trick inspired by CHICKEN Scheme. Performance after warmup ranges from roughly 3× faster to 3× slower versus GHC, typically 10-20% slower; recent development work introduced a ~10× regression on some benchmarks. Source and docs are on github.com/ekmett/thc and development happens on libera IRC.

Read on comonad.com2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.