benrbray / ghc-wasm-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ghc-wasm-example

A working example demonstrating the use of:

At the moment, the build is based mostly on Brandon Chinn's fourmolu-wasm setup, in addition to the following resources:

Setup

Install ghc-wasm-meta according to the "Getting Started without Nix". I am using FLAVOUR=9.8. Then, populate your environment with source ~/.ghc-wasm/env.

$ wasm32-wasi-ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.8.0.20230809

$ wasm32-wasi-cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library

Next, follow the instructions to set up head.hackage, which allows Hackage packages to be used with GHC prereleases (such as ghc-wasm).

Build

The build scripts are organized as a justfile.

just build-wasm

Once the Haskell project has been built, you can run the frontend in development mode with:

cd frontend
npm run dev

About


Languages

Language:Haskell 44.3%Language:TypeScript 36.7%Language:C 10.9%Language:Shell 3.6%Language:CSS 2.3%Language:HTML 1.5%Language:Just 0.7%