Read and run

Examples

Code to read and to run, from a tested set of classic algorithms to a server module on six platforms. Each has its source, the command that runs it and, where there is one, the number of checks it carries (recorded 2026-11-16).

The language

F# programs compiled to WebAssembly GC and checked end to end.

  • Showcase: classic algorithms

    Fibonacci, primes, two Project Euler problems, Collatz, FizzBuzz, list and array pipelines, records, sorting, strings and options — compiled to WasmGC and checked on Node.

    26 checks

    Run: bash tests/Showcase/run.sh

    Source · fsharp-wasm

Components

WIT worlds and modules linked at run time.

  • Component embed

    A small F# module (MathCore) compiled to WasmGC; its WIT world is generated and embedded with wasm-tools.

    39 checks

    Run: cd examples/component-embed && bash run.sh

    Source · fsharp-wasm

  • Component linking

    Two independent F# modules, MathCore and App, compiled separately and linked at run time: the app imports the core’s functions.

    22 checks

    Run: cd examples/component-linking && bash run.sh

    Source · fsharp-wasm

Backend

A server module in F#, and the matrix that runs it on every platform.

  • Ghost Todo

    A server module in F#, 47 KB of WebAssembly GC: a todo list whose every change is a binary patch that a client applies to a shadow copy. Runs on six platforms in the test matrix.

    Source · fsharp-wasm-backend

  • Ghost Todo on a canvas

    The second client of the same server, written in F# with the widgets of fsharp-wasm-graphics and drawn onto a canvas (197 KB of WebAssembly GC). It keeps a shadow of the list, applies the patches, copes with a server that is gone and can be operated by keyboard. Served by every platform at /canvas/; what it does shows on the first client and the other way round.

    22 checks

    Run: bash build/build.sh --module canvas && node tests/e2e/canvas.mjs

    Source · fsharp-wasm-backend

  • Ghost Todo benchmark

    The module against hand-written JavaScript and Hono on Node, Bun and workerd, with three implementations that answer identically: 1.8 times the hand-written JavaScript on a poll and 4 to 11 times where the answer is long on Node, after a bulk path for strings (14 to 24 times before; measured 2026-11-22, local and in-process); the numbers and what they mean are in the README.

    Run: node bench/run.mjs

    Source · fsharp-wasm-edge

  • Platform matrix

    The same module on Node, Bun, Deno, Cloudflare Workers (with a Durable Object), the Vercel and Netlify handlers: one command, identical answers.

    Run: npm ci && node build/package.mjs && node tests/platforms/run.mjs

    Source · fsharp-wasm-edge

Graphics

Scenes, rasterizers and hosts.

  • Scene gallery sources

    The module behind the live scene gallery and the thirteen scenes it shows (FSharp.Graphics.Scenes).

    Source · fsharp-wasm-graphics

  • Scene renderer (PNG)

    Renders every scene with the software rasterizer to one PNG per scene plus an index page; exits 1 if a command stream is malformed.

    Run: dotnet run --project demo/FSharp.Graphics.Demo -- --list

    Source · fsharp-wasm-graphics

  • Desktop runner

    A native desktop host for the same scenes: arrow keys switch scenes, B toggles the Skia and the software backend (same command stream, so a difference is a bug), F12 takes a screenshot.

    Source · fsharp-wasm-graphics

Text

Shaping and layout.

  • GlyphAura demo

    Shapes a line of text with GlyphAura and prints an ASCII rendering of the layout.

    Run: dotnet run --project demo/GlyphAura.Demo

    Source · fsharp-glyph-aura

Tools

Programs written in F# for F# programmers.

  • Widget editor

    The visual editor for FSharp.Graphics widget layouts, written in F# and compiled to WebAssembly GC; also a live demo.

    Source · fsharp-wasm-ide

Experiments

What we tried, with the numbers.

  • WIT component spikes

    A WebAssembly GC module made a WIT component two ways (a second module for the memory; the adapters inside the module), run through jco on Node, with measured cost.

    Source · fsharp-wasm-edge

And the live demos

The 12 demos on the demos page are examples too: every one has its source in fsharp-wasm-runtime.

See the live demos