Skip to content

SchlenkR/TypeFighter

Repository files navigation

TypeFighter

📖 Browse the generated docs site →

TypeFighter is a small, experimental language built around a modern, inference-first type system. The headline feature is structural records instead of nominal ones: records are compared by the fields they actually have, not by a declared name — so a function that needs { name: String } accepts any record with that field, no boilerplate declarations required.

On top of that: row polymorphism, set-theoretic literal and union types, and classical polymorphic functions — all figured out by the type checker with (almost) no annotations.

Companion repository for the YouTube video: Type Inference Explained

Documentation

The documentation site is generated directly from the test suite under src/TypeFighter.Tests/TestCases/. Every test is a minimal example of what the type system can — and can't yet — do, grouped into categories:

Literals · Functions · Let bindings · Generalization · Arrays · Records · Rows · Polymorphism · Intersections · Type hierarchies

To build the site locally:

dotnet fsi docs/build.fsx
open docs/output/index.html

Running the test suite

dotnet test

Project layout

TypeFighter/
├── docs/
│   ├── build.fsx              # Site generator (reads tests → emits HTML)
│   └── output/                # Generated site (gitignored)
├── src/
│   ├── TypeFighter/           # Type inference engine
│   │   ├── Lang.fs            # Core types, constraints, solver
│   │   └── ExpressionDsl.fs   # AST-building DSL used in tests
│   ├── TypeFighter.Tests/     # NUnit tests; one file per feature area
│   └── visu/                  # Optional AST visualizer (TypeScript + Vite)
└── .github/workflows/docs.yml # CI: builds and deploys the docs site

Visualizer (optional)

A legacy AST visualizer lives under src/visu/. To start it:

npm install
npm start

License

This project is not available for use in any projects, whether commercial or non-commercial. If you are interested in using it, please contact me directly.

About

A graph based approach to type inference written in F#

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors