# Haskell via WebAssembly on Fastly

**URL:** <https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937>\
**Category:** Uncategorized\
**Created:** [March 7, 2023, 10:58am UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937 "2023-03-07T10:58:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nomeata](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/nomeata/32/1188_2.png) [@nomeata](https://discourse.haskell.org/u/nomeata)\
**Post date:** [March 7, 2023, 10:58am UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937/1 "2023-03-07T10:58:53Z")

</div>

If you go to [https://haskell-on-fastly.edgecompute.app/](https://haskell-on-fastly.edgecompute.app/) you see a very boring page that is produce by Haskell code compiled to WebAssembly and running on [Fastly’s Compute@Edge](https://www.fastly.com/products/edge-compute) infrastructure.

The code behind it is on

> **[GitHub - nomeata/haskell-on-fastly: Experiments about running Haskell via...](https://github.com/nomeata/haskell-on-fastly)**
>
> Experiments about running Haskell via WebAssembly on Fastly - GitHub - nomeata/haskell-on-fastly: Experiments about running Haskell via WebAssembly on Fastly

It’s a demo only so far, not a complete and production-ready support (and I don’t know if I’ll build that).

Thanks a lot to @TerrorJack for building these things, and helping me.

---

<div class="post-metadata">

**Author:** ![Vlix](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/vlix/32/1551_2.png) [@Vlix](https://discourse.haskell.org/u/Vlix)\
**Post date:** [March 7, 2023, 11:44pm UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937/2 "2023-03-07T23:44:24Z")

</div>

> - Haskell’s GHC compiler supports compiling to WebAssembly since GHC-9.8

Did you mean 9.6? Or is this using something that won’t be “stable” until 9.8?

---

<div class="post-metadata">

**Author:** ![nomeata](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/nomeata/32/1188_2.png) [@nomeata](https://discourse.haskell.org/u/nomeata)\
**Post date:** [March 8, 2023, 8:16am UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937/3 "2023-03-08T08:16:52Z")

</div>

The latter, the WebAssembly backend is going to ship with 9.8. If you go to [https://haskell-on-fastly.edgecompute.app/](https://haskell-on-fastly.edgecompute.app/) it more correctly says:

> Compiled by ghc 9.7.20230215 running on wasi-wasm32

---

<div class="post-metadata">

**Author:** ![unhammer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/unhammer/32/580_2.png) [@unhammer](https://discourse.haskell.org/u/unhammer)\
**Post date:** [March 22, 2023, 10:03am UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937/4 "2023-03-22T10:03:16Z")

</div>

So IIUC, Fastly’s server is running a wasm binary which fetches GET/POST params and spits out html?  
And you use the Fastly.hs interface to do the IO?

(So this is not about running Haskell in the browser, but on the server, for servers that don’t let you run regular Haskell binaries, but require `.wasm` binaries.)

---

<div class="post-metadata">

**Author:** ![nomeata](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/nomeata/32/1188_2.png) [@nomeata](https://discourse.haskell.org/u/nomeata)\
**Post date:** [March 22, 2023, 11:27am UTC](https://discourse.haskell.org/t/haskell-via-webassembly-on-fastly/5937/5 "2023-03-22T11:27:37Z")

</div>

Exactly!

(And “Exactly!” has less than 20 characters)
