~/talk

Compiling Haskell to WebAssembly

Talkat ZuriHac 2025 · 2025-06-07..06-09· [haskell, webassembly]
slides:none on file

GHC’s WebAssembly backend compiles real Haskell apps into runnable .wasm modules, using wasmtime for CLI and a tiny npm shim for browser runs; post-link wasm-opt shrinks a raw 8.5 MB build to 3.6 MB (wasm-opt shrinks 8.5MB → 3.6MB). JavaScript FFI supports synchronous and async imports/exports, pinned byte arrays for zero-copy buffers, and foreign import javascript wrapper callbacks; a service worker SHA‑256 demo and benchmarks show serial fetch ~220 ms vs concurrent async ~133 ms (GHCI browser mode). Runtime threading and better observability are planned.

AI-written summary · about

  1. 0:00Introduction & structure of the talk
  2. 1:15Lesson 1 – Don’t use frameworks
  3. 5:45WebAssembly basics & minimal runtime
  4. 10:40WASI vs JS FFI & standalone deployment
  5. 16:30Lesson 2 – Validate everything
  6. 18:32Structure of core expressions & output control
  7. 23:10Compilation pipeline & target representation
  8. 27:55Memory layout in Wasm
  9. 33:20Lesson 3 – Debug early
  10. 36:00Tools, backtraces & observability
  11. 40:30Lesson 4 – Avoid concurrency (for now)
  12. 45:20GHC runtime limitations & async model
  13. 49:10Haskell concurrency semantics in Wasm
  14. 53:00Live Demo 1 – Browser-based Haskell runtime
  15. 57:40Live Demo 2 – Service Worker & crypto
  16. 1:02:30Lesson 5 – Don’t be afraid of rewriting
  17. 1:06:15Benchmarks & performance notes
  18. 1:10:00Limitations & future directions
  19. 1:15:10Q&A and wrap-up
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.