Yes, the Haskell compiler (GHC) can compile to JS or Wasm now
Yes, the Haskell compiler (GHC) can compile to JS or Wasm now
Posted Apr 1, 2026 20:55 UTC (Wed) by dcoutts (subscriber, #5387)Parent article: Pandoc: a workhorse for document conversion
Much credit for this goes to the many contributors to GHC (the Haskell compiler) who have been working on the JS and Wasm backends for GHC in the last few years. The wasm backend was included in ghc 9.6 in 2023, and has matured significantly over the last few major releases. This now allows more-or-less any Haskell program to be compiled to JS or Wasm. The Wasm backend supports FFI for interacting with JS, or with C code libraries compiled to wasm.
A bit of history: ghcjs was started around 15 years ago or so, as a fork of ghc to compile to JS. (Indeed I used an early version of ghcjs as one of the organisers of the 2014 ICFP programming contest to provide contestants with a web-based reference simulator for the task.) More recently, the ghcjs author and other GHC contributors have been working on integrating ghcjs as a proper backend in the mainline ghc, and concurrently a project for a wasm backend was started too, which shares much of the same infrastructure.
