-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49c15ba
commit 5c330cc
Showing
3 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
# GHC WebAssembly Backend Demonstration - ZuriHac 2024 | ||
|
||
Credits: | ||
At ZuriHac 2024, [Jane Street](https://www.janestreet.com/) was giving out | ||
shirts with the following prompt on the back: | ||
|
||
 | ||
|
||
I was looking to do something with [GHC's WebAssembly (wasm) | ||
backend](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/wasm.html), so I | ||
decided to solve the problem above using a WebAssembly simulation in the | ||
browser. | ||
|
||
Here it is in action: | ||
|
||
 | ||
|
||
All of the logic for this simulation is written in Haskell and compiled to wasm, | ||
including: | ||
|
||
- Concurrent execution of each simulation | ||
- Mutex protecting the HTML canvas rendering context | ||
- Randomness using the [random](https://hackage.haskell.org/package/random) | ||
package | ||
|
||
No libraries were used for interacting with the DOM, just raw JavaScript FFI | ||
through the wasm backend. | ||
|
||
## Build it and try it yourself | ||
|
||
The [ghc-wasm-meta](https://gitlab.haskell.org/ghc/ghc-wasm-meta) README is a | ||
good resource for setting up a wasm cross compilation toolchain. The GHC team | ||
does supply official distributions of wasm cross compilers for Linux, but not | ||
other platforms (yet). On other platforms (e.g. macOS), you will need to build a | ||
cross compiler from source. | ||
|
||
Once you have a toolchain set up, you can simply run the `./build.sh` file in | ||
this repository and serve the `dist` directory on a local file server. | ||
|
||
## Credits: | ||
|
||
- Finley McIlwaine (author) | ||
- Andreas Klebinger (@AndreasPK) | ||
- Zubin Duggal (@wz1000) | ||
- Andreas Klebinger ([@wz1000](https://github.com/AndreasPK)) | ||
- Zubin Duggal ([@wz1000](https://github.com/wz1000)) | ||
- [ZuriHac 2024](https://zfoh.ch/zurihac2024/) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.