ICFP 2024
Mon 2 - Sat 7 September 2024 Milan, Italy
Sat 7 Sep 2024 12:07 - 12:30 at Orange 3 - Haskell 4 Chair(s): Michael D. Adams

The GHC wasm backend supports the JavaScript FFI feature for calling JavaScript from Haskell and vice verca, while managing JavaScript values as garbage collected Haskell values on the Haskell heap. It has been evaluated in experimental projects that port the miso frontend framework or runs Haskell in Cloudflare Workers, demonstrating the utility of JavaScript FFI in its current form.

The implementation poses a few interesting challenges:

  • How to support asynchronous computation in JavaScript as Haskell green threads that can be concurrently executed?
  • How to garbage collect JavaScript values with the Haskell garbage collector and vice versa, given we cross-compile the GHC RTS to wasm and the Haskell heap is distinct from the host heap?
  • How to avoid paying for JavaScript when not using it, ensuring we can always generate self-contained wasm modules when not targeting the web?

This talk will dive into the rabbit holes and explain the solutions of the questions above. The most interesting part is how we implement a Haskell thread scheduler in Haskell userspace on top of the RTS scheduler, and the same technique might be useful for writing third party I/O managers for native platforms as well.

Sat 7 Sep

Displayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change

11:00 - 12:30
Haskell 4Haskell at Orange 3
Chair(s): Michael D. Adams National University of Singapore
11:00
22m
Talk
[HIW] Analysing the heap of uninstrumented Haskell programs using ghc-debug
Haskell
Zubin Duggal Well-Typed LLP
11:22
22m
Talk
[HIW] A zero-copy interface to compact regions powered by destinations
Haskell
Thomas BAGREL Tweag, LORIA/INRIA
11:45
22m
Talk
[HIW] Building Haskell with Buck2
Haskell
Andreas Herrmann Tweag by Modus Create
12:07
22m
Talk
[HIW] The JavaScript FFI feature in GHC Wasm backend
Haskell
Cheng Shao Modus Create