Beyond Hindley-Milner: A Tutorial on the Cubiml Compiler with Algebraic Subtyping

2025-06-13

This blog post series introduces Cubiml, a compiler tutorial built around a novel type inference system called "cubic biunification," an improvement on Algebraic Subtyping. It addresses the limitations of the Hindley-Milner system's lack of subtyping support, providing more powerful and intuitive type inference. The tutorial walks through the implementation of Cubiml with detailed code examples, covering booleans, conditionals, records, functions, let bindings, recursive let bindings, mutual recursion, and case type matching. The ultimate goal is a compiler that type-checks programs without requiring manual type annotations.

Development