hn.today

Turbo Haskell

comonad.com194 points58 comments
Screenshot of Turbo Haskell

Turbo Haskell (THC) is a JIT/AOT compiler and runtime that executes GHC Core on the JVM using Truffle and GraalVM. It implements the full set of GHC 9.14.1 prim-ops and relies on GHC for parsing, typechecking, desugaring, and Core optimizations; THC then compiles and runs that Core, supporting advanced features such as Template Haskell and Linear Haskell. THC can produce native images via GraalVM Native Image or run JIT-compiled, and it already compiles substantial real-world Haskell programs (pandoc, happy, alex and even GHC itself). Package resolution uses Cabal and supports multi-library packages including Backpack.

The runtime exposes rich polyglot FFIs to Python, Ruby, R, and JavaScript with zero-copy Text-to-Truffle string conversion for UTF-8, and runs C/C++ bits through Sulong (native-mode or managed-mode). Two Truffle backends (bytecode and AST) and support for GHC bytecode power evaluation; concurrency includes throwTo, asynchronous exceptions with resumable code, masking, normal Java threads or Project Loom-based lightweight green threads with an HEC-style executor. SIMD is handled via available prim-ops and the incubating Vector API with runtime species selection. Tail calls are kept hot via code-transformation loops, a Bloom-filter tracing mechanism and slow-path linking, with occasional stack compaction inspired by CHICKEN Scheme. With compressed oops and warmup, microbenchmarks ranged from ~3× faster to ~3× slower, typically ~10-20% slower than GHC; some regressions exist while broadening feature coverage. Source is on github.com/ekmett/thc and development happens on IRC.

Read on comonad.com58 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

Zig v0.17.0

Zig v0.17.0

Zig 0.17.0 introduces a reworked build system, including a new Build Server Protocol and enhanced ELF Linker for better incremental compilation on x86_64-linux. The release also features numerous language, standard library, and package management improvements contributed by over 200 developers. (ziglang.org)

Hardly Promethean

Hardly Promethean

Decreasing costs of native app development and performance optimization shift the software bottleneck from coding to deployment and maintenance. Experts argue that while technology enables faster coding, managing and shipping updates remains a significant challenge. (jardo.dev)

The daily digest

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