Learn functional programming by building a linear-time regular expression engine in Idris 2, test-first.
This repository contains:
regex/: the engine itself, written in Idris 2 with TDD. Matching runs in a single left-to-right pass over the input, so there is no backtracking to blow up.content/: the tutorial book (English / 日本語), built with Vite+ and Ox Content.
Functional programming has a reputation for being hard to start. This tutorial takes the opposite route: build one small, real, useful thing (a regex engine) and let each language feature earn its keep, one chapter at a time.
- No prior functional programming experience required.
- Every feature starts with a failing test.
- The commit history is the tutorial: each step is a small red/green commit you can replay.
Read it on the site (English / 日本語) or right here on GitHub, in order:
Read the book, or jump straight into the code:
cd regex
make test # build the library and run the whole suite
make bench # race the derivative engine against a backtrackerTo run the book locally:
pnpm install
pnpm dev # English
pnpm dev:ja # 日本語The book deploys to Void from GitHub Actions using OIDC, so there is no long-lived secret to store. One-time setup:
pnpm exec void initlocally (log in and link/create the project).- Set the repository variable
VOID_PROJECTto the project slug. The Deploy workflow switches on automatically from the next push tomain.