Skip to content
yelouafiPublic

About

A runnable, steppable exploration of Essential Verse in the browser: logic variables, choice, and a verifier that runs functions on unknown arguments

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

funl

funl is a small, runnable exploration of Essential Verse, the calculus and rewriter in which the authors of the Verse Calculus define Verse's semantics. It is not a new programming language, and not a Verse implementation. It makes the ideas of Verse easy to try in a browser: logic variables and equations, choice, failure as control flow, types as functions, patterns as expressions, and a verifier that runs functions on unknown arguments instead of assigning types. Programs run on an abstract machine you can step through. funl follows Essential Verse where it can, and lists where and why it differs in docs/departures.md; what it lacks is in docs/feature-map.md. The original material stays the reference.

Try it at yelouafi.github.io/funl: the guide, and the debugger.

Three things are called Verse:

  • The Verse Calculus (VC), the core calculus of the ICFP 2023 paper.
  • Essential Verse, the authors' later language, grown out of VC (2 ways to call a function, effects a verifier checks, parameters as patterns) and still a work in progress, with its rewriter augustss/verse-semantics. Simon Peyton Jones's OPLSS 2026 lectures teach it as MaxVerse. funl follows it, and "Verse" means it here.
  • Shipped Verse, the language Epic Games released in Unreal Editor for Fortnite (ShipVerse in the lectures). For now it is a different language, much closer to conventional object-oriented languages, and funl programs are not UEFN programs. funl takes a few things from it: the type type and heap effects.

The guide's introduction says more.

Status

funl is an exploration, not a finished tool, and its verifier is the least settled part. "Proved" means: on a known argument in the function's domain, if the call's own work ends, it gives a count of results its effect allows. That rests on reading only the verification's clean worlds, where nothing waited, and the step from a clean world to a real call is argued and tested against the machine, not proved. Verify says inconclusive more often than the authors' rewriter (mutual recursion and forward references are never proved, for instance), and a finding with no example may be one no run shows. docs/verify.md states the claim and its limits, docs/departures.md every difference from Essential Verse, and docs/verify-survey.md the approaches weighed before this design.

Quick start

Use Node 24.11+ (Node 22.18+ is also supported) and npm:

npm ci
npm run dev

Open the local URL printed by Vite+.

The guide

The guide is the home page (index.html); the debugger (debugger.html) links to it from its header. The guide opens with an introduction to what funl is and which Verse it follows, then teaches funl in three parts. The language is a tutorial whose examples can be edited and run again on the machine, with verify's findings under each. The machine and The verifier explain the implementation with figures that are the real thing: the machine recorded step by step, the worlds a verification splits into for a program you can change, and the fact solver on facts you type. Terms from logic programming and program analysis are defined on hover. The guide's programs are in src/learn/snippets.ts, and a test checks that each gives what the text says.

The debugger

The debugger runs one of 84 numbered examples, grouped from a single value up to references, effects and verification. The picker opens on the current example's group; typing filters all examples by title, concept or description, the arrow keys and Enter choose among the matches, and ‹ › step to the previous or next example. Collapsed Example notes give each example's teaching point and expected answers. Most examples finish; a few end otherwise on purpose: "An input never arrives", "Two ways to call", "An unfinished search" and "An unresolved first alternative" end stuck, and "Collecting an infinite search" and "A loop hides a failure" never finish, so a run stops at its step budget.

Step through execution, stopping at key events, or Run with a bounded step budget. Panels show the source (or its Core form), the search tree, each branch's bindings and pending tasks, the results, and the execution trace; Back and the trace step through history. Each function has a verify row with its verdict and a button to step its verification. The machine runs in a Web Worker. See docs/language.md for the controls in detail.

Commands

Command What it does
npm run dev Serve the debugger and the guide locally
npm run demo Trace the suspended addition in the constrained-sum example, and print the results of the built-in examples
npm test Run the tests
npm run check Check formatting and lint, then type-check with tsc
npm run build Build the application into dist/ and the library into dist/library/funl.js
npm run preview Serve the production build
npm run build:lib Build only the machine library

The machine has no Node or DOM dependencies and runs on its own, outside the browser; docs/language.md shows its API.

The toolchain is pinned to Vite+ 1.5.0 and native TypeScript 7.1.0-beta. The native compiler is distributed as typescript and invoked with tsc; a separate Go installation is unnecessary. Vite+ supplies the formatter, linter, and test runner. The npm overrides align Vite/Vitest with Vite+ and explicitly select the TypeScript beta, which ordinary stable peer ranges exclude.

Docs

  • language.md: the language reference, construct by construct, and the debugger's controls.
  • departures.md: where and why funl differs from Essential Verse, grouped by whether each difference is approved.
  • machine.md: the abstract machine's design.
  • parser.md: syntax, lowering, scope, source ranges and errors.
  • verify.md: verify as a mode of the machine.
  • verify-survey.md: static-analysis approaches surveyed for verify, and the clean-worlds design it adopted.
  • denotational-semantics.md: the authors' set-theoretic semantics in progress (Timbda-0), and what it means for verify.
  • feature-map.md: funl against the Verse Calculus, construct by construct.
  • roadmap.md: where funl goes next, towards Verse.
  • guide-voice.md: how the guide is written.

References

License

MIT.

About

A runnable, steppable exploration of Essential Verse in the browser: logic variables, choice, and a verifier that runs functions on unknown arguments

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages