From 61659ed7bf697edd39ca7254dca249ce99887f98 Mon Sep 17 00:00:00 2001 From: David Johnson Date: Thu, 5 Nov 2026 14:38:45 -0600 Subject: [PATCH] miso.yml: the sampler as a project of the miso tool - miso.yml: the sampler as a project of the miso tool (MicroHs, no GHC), with its own index.html in miso-static/ (static/index.html loads the GHC build's index.js as a module). - README: building with the miso tool, and setup-miso in CI. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 3 +++ README.md | 18 +++++++++++++++++- miso-static/index.html | 11 +++++++++++ miso.yml | 12 ++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 miso-static/index.html create mode 100644 miso.yml diff --git a/.gitignore b/.gitignore index a78fdf2..a234984 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ result public .mcabal .emcache +.miso/ +.mhscache +.miso-build.log diff --git a/README.md b/README.md index 614a0fa..10fcbdd 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,16 @@ $ nix develop .#ghcjs --command bash -c "make js" $ nix develop .#mhs --command bash -c "make mhs" ``` +### The miso tool (MicroHs, without nix) + +The sampler is also a project of the [miso tool](https://haskell-miso.org/docs/cli) (`miso.yml`), which builds it with MicroHs, without GHC or nix ([emscripten](https://emscripten.org) is needed for the browser): + +```bash +$ curl -fsSL https://haskell-miso.org/download | sh +$ miso dev # build, serve on http://localhost:8000, rebuild and reload on save +$ miso build # public/ +``` + ### Serve To host the built application you can call `serve` @@ -131,6 +141,12 @@ Ensure that the Haskell miso [cachix](https://haskell-miso-cachix.cachix.org) is name: haskell-miso-cachix ``` +In CI, the [setup-miso](https://github.com/haskell-miso/setup-miso) action installs the miso tool and runs `miso build` (with emscripten): + +```yaml +- uses: haskell-miso/setup-miso@v1 +``` + ### Hosting -To upload and host your project to Github Pages, please see [our Github workflow file](https://github.com/haskell-miso/miso-sampler/blob/main/.github/workflows/main.yml#L38-L56) and the necessary Github actions included. +The site is built with the miso tool and deployed to GitHub Pages: see the `miso` and `deploy` jobs of [our Github workflow file](https://github.com/haskell-miso/miso-sampler/blob/main/.github/workflows/main.yml). diff --git a/miso-static/index.html b/miso-static/index.html new file mode 100644 index 0000000..b90c6a5 --- /dev/null +++ b/miso-static/index.html @@ -0,0 +1,11 @@ + + + + + + miso-sampler + + + + + diff --git a/miso.yml b/miso.yml new file mode 100644 index 0000000..119c15f --- /dev/null +++ b/miso.yml @@ -0,0 +1,12 @@ +# The sampler as a project of the miso tool (MicroHs, no GHC): miso dev to +# develop, miso build to build public/ (this is what CI deploys). app.cabal +# and the Makefile build it with GHC instead. +name: miso-sampler +version: 0.1.0 +main: Main +source-dirs: [app] +# browser: WebAssembly (needs emcc) +target: browser +# its own index.html: the one in static/ loads the GHC build's index.js +static-dir: miso-static +dependencies: [miso]