Skip to content

tweag/ghc-wasm-reflex-examples

Repository files navigation

ghc-wasm-reflex-examples

Chat on Matrix

The GHC wasm backend supports the JSFFI feature, allowing Haskell wasm apps to interop with JavaScript seamlessly in the browser. This repo contains an example to demonstrate this ability based on the reflex frontend framework as well as an experimental jsaddle-wasm library under the hood.

See also: ghc-wasm-miso-examples

Live demo

Building

With nix

Within the nix develop shell:

cd frontend
wasm32-wasi-cabal update
./build.sh

If you pass additional arguments to build.sh, they will be redirected to wasm-opt, otherwise a dev build without wasm-opt will be performed.

The artifacts will be available in frontend/dist.

Without nix

You can set up the toolchain by either:

  • Using ghc-wasm-meta directly to set up ghc 9.10
  • Using ghcup to set up ghc 9.10 (9.10.1.20241021 or later, with TemplateHaskell support) and cabal >=3.14.

Then:

source ~/.ghc-wasm/env
cd frontend
./build.sh

Acknowledgements

The examples are vendored and modified from the following projects:

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published