[WIP] WebAssembly Backend Redux!

Hi folks!

I’d like to share a project I’ve been working on: a WebAssembly backend for PureScript.
You can see the codebase including some examples, documentations and benchmarks here:
https://github.com/katsujukou/purescript-backend-wasm

Actually, I tried to take on the same challenge about three years ago, but at the time it didn’t go very far due to my lack of compiler development experience. Since then, though, I’ve spent a lot of time studying compiler theory, building a few language implementations of my own, and—perhaps most importantly—the arrival of coding agents (honestly, that’s probably been the biggest factor :smile:). With all of that behind me, the project is finally moving again!

It’s still very much at the proof-of-concept stage, but it’s already capable of handling a fair amount of PureScript:

  • Higher-order recursive functions and partial application—the essentials of functional programming
  • ADTs, pattern matching, arrays, and records
  • Typeclass polymorphism
  • Full Prelude support
  • A few optimizations such as typeclass dictionary elimination and primitive inlining (still a work in progress!)

There’s still a long way to go before it’s truly practical, but given how quickly things have been progressing over the last few days, I’m starting to think it won’t be too long before we can write reasonably sized applications in PureScript, compile them to wasm binary, and run them from browser or node host environment.

I’ll keep working on it and share more updates as things progress. So please stay tuned!

1 Like

I’m glad to see this being built. I’ve personally been looking for something like this for years now. Thanks for taking it on. Good luck!

1 Like