This repository contains a series of guided exercises to learn the fundamentals of functional programming in TypeScript. You will work through pure functions, higher-order functions, composition, immutability, currying, and a real-world data pipeline.
You must have bun ≥ 1.3 installed on your system
git clone <your-fork-url>
cd ex-fp
bun install
bun test # run the full test suite- Pure functions
- Higher-Order Functions
- Composition
- Immutability
- Currying
- Options
- Data transformation pipelines
Work through the modules in order, later modules build on earlier ones.
- Open the exercise file for the current module.
- Read the module comment at the top and the doc comment above each function.
- Write your implementation.
- Run
bun test(orbun test --watch) to check your work. - Move to the next exercise when all tests pass.
You can run a single module's tests with:
bun test src/tests/01-pure-functions.test.ts- Do not modify the test files. Tests are the specification, your code must satisfy them as written.
- No AI for solutions. The goal is to build a mental model of FP. If you ask an AI to write the code for you, you defeat the purpose entirely. Use AI only to ask for explanations of concepts you do not understand.
- One commit per exercise Use Conventional Commits.
bun run format # format all files with oxfmt
bun run format:check # check formatting without writing
bun run lint # lint with oxlintRun bun run format before submitting.