A real miso 1.11 counter app, written in Haskell, compiled to WebAssembly by the stable-haskell wasm cross-compiler. The wasm module below was built by the miso-counter template and is loaded directly into your browser.
Click + / - above — the wasm module updates an
Int model, miso diffs the virtual DOM, and patches the real
DOM directly above this line. Open the browser console for the
[hs stdout] lines coming out of the Haskell program through
browser_wasi_shim's ConsoleStdout.
app/Main.hs — the miso component
(component smart constructor, updateModel, viewModel)cabal.project — dual-compiler + miso 1.11 source-repo pinmyapp.cabal — wasm reactor flags + ghc-experimental depexamples/miso-counter/ — browse all filesBuild it yourself:
curl -L -o miso.tar.gz \
https://stable-haskell.github.io/ghc/examples/stable-haskell-wasm-miso-counter.tar.gz
tar xf miso.tar.gz && cd stable-haskell-wasm-miso-counter
export PATH="$HOME/.ghcup/ghc/wasm32-wasi-9.14.0.stable.1/bin:$PATH"
make run-web # http://localhost:8000 — identical UI to the one above