7sharp9/write-you-an-inference-in-fsharp
40.7
Weak · 15 November 2026
2.2k
lines of production code
F#
primary language
4
measurements over time
What this system is
This system is a collection of experimental modules implementing various algorithms for Hindley-Milner type inference within the .NET 8.0 ecosystem. It provides distinct engines for basic, pure, and mutable type checking, along with advanced support for row polymorphism, arbitrary-rank polymorphism, and split constraint generation. The codebase serves as a technical demonstration of these type-checking strategies, including performance benchmarks and test suites for lambda calculus expressions.
Features
Initial implementation of mutable Hindley-Milner type inference
Added a new HMMutable module providing a mutable Hindley-Milner type inference engine for a functional expression language. The implementation includes core type system components such as type variables with mutable links, unification, generalization, and instantiation, along with utilities for pretty-printing expressions and types. A demonstration program is included to run a test bank of lambda calculus expressions and benchmark the inference performance.
HMMutable · high confidence
Initial implementation of pure HM with row polymorphism
This change introduces a new module, HMPureRowpolymorphism, which implements a pure Hindley-Milner type inference engine supporting row polymorphism. The implementation includes type definitions for expressions, primitive operations (such as record selection, extension, and restriction), and row-based types, along with core algorithms for unification, substitution composition, and type generalization. A companion Program.fs file provides a test bank of expressions to validate the type inference logic and benchmarks its performance.
HMPure-Rowpolymorphism · high confidence
Introduce Hindley-Milner type checker for basic expressions
Added a new HMBasic module implementing the Hindley-Milner polymorphic type-checking algorithm. This feature allows users to analyze basic functional expressions (identifiers, lambdas, applications, let/letrec bindings) against a predefined environment, inferring their types or reporting mismatches. The implementation includes core type unification, variable pruning, and generic/non-generic variable handling, demonstrated via a test bank of examples including factorial, function composition, and type-error cases.
HMBasic · high confidence
Introduce arbitrary-rank type inference engine
The HMRankN module implements type inference for arbitrary-rank polymorphism, extending standard Hindley-Milner to support nested forall quantifiers (e.g., rank-2 and rank-3 types). This is achieved through bidirectional type checking, subsumption at call sites, and skolemisation with escape checks, following the Peyton Jones & Shields (2007) algorithm. The Program.fs file provides a demo runner that validates this capability with examples including rank-2 functions accepting polymorphic arguments and rank-3 nested structures, alongside standard rank-1 cases.
HMRankN · high confidence
Introduce mutable HM type inference with row polymorphism
Added a new module implementing Hindley-Milner type inference with mutable type variables and support for row polymorphism (record extension, selection, and restriction). The implementation includes a type system for records, an environment-based inference engine, and a test bank demonstrating usage with basic types and functions.
HMMutable-RowPolymorphism · high confidence
Introduce pure type inference engine for a lambda calculus
A new HMPure module implements a Hindley-Milner style type inference system for a pure lambda calculus, including expression representation, type schemes, substitution, and unification logic. The accompanying Program.fs provides a benchmark harness that runs a test bank of expressions through the type inference engine to measure performance, establishing the core algorithmic capability for this isolated component.
HMPure · high confidence
Introduce split Hindley-Milner type inference with constraint generation and solving
The HMSplitSolve module now implements a two-phase type inference system that separates constraint generation from constraint solving. Users can now infer types for expressions involving variables, applications, lambdas, let bindings, literals, conditionals, and fixpoints. The system generates constraints during the inference phase and solves them using unification with an occurs check to prevent infinite types. A test bank is included to verify the inference logic, and the main entry point demonstrates how to retrieve inferred types, substitutions, and schemes for specific expressions.
HMSplitSolve · high confidence
Dependencies
Add .NET 8.0 project files for HM inference modules
New .fsproj files have been added for the HMBasic, HMMutable, HMMutable-RowPolymorphism, HMPure, HMPure-Rowpolymorphism, HMRankN, and HMSplitSolve modules, all targeting .NET 8.0. The HMMutable, HMMutable-RowPolymorphism, HMPure, HMPure-Rowpolymorphism, and HMSplitSolve projects additionally include a dependency on the ExtCore library (version 0.8.46).
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 44 → 41 (-2.9)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 94 → 67 (-27.0)
- Architecture 100 → 100 (+0.0)
- Maturity 50 → 54 (+3.7)
- Readiness 10 → 10 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (4)
- Duplicated block (12 lines × 2) (HMPure-Rowpolymorphism/HMPureRowpolymorphism.fs)
- Near-duplicate member pair (145 shared lines) (HMPure-Rowpolymorphism/HMPureRowpolymorphism.fs)
- No ADRs found
- No tests found
New (2)
- Near-duplicate member pair (145 shared lines) (HMPure-Rowpolymorphism/HMPureRowpolymorphism.fs)
- No ADRs found (HMBasic/inference.fsproj)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
7sharp9/write-you-an-inference-in-fsharp was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 4a6f852f36115ad45ac9640753a0bd38f551300c — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.