Journal article
Cite …

A Systematic Approach to Deriving Incremental Type Checkers

André Pacak, Sebastian Erdweg ORCID iD icon 1 and Tamás Szabó
1 Institute for Program Structures and Data Organisation (IPD), Karlsruhe Institute of Technology (KIT)
DOI: 10.5445/IR/1000188599
Publisher's version published on Dec 22, 2025
CC BY 4.0
Abstract

Static typing can guide programmers if feedback is immediate. Therefore, all major IDEs incrementalize type checking in some way. However, prior approaches to incremental type checking are often specialized and hard to transfer to new type systems. In this paper, we propose a systematic approach for deriving incremental type checkers from textbook-style type system specifications. Our approach is based on compiling inference rules to Datalog, a carefully limited logic programming language for which incremental solvers exist. The key contribution of this paper is to discover an encoding of the infinite typing relation as a finite Datalog relation in a way that yields efficient incremental updates. We implemented the compiler as part of a type system DSL and show that it supports simple types, some local type inference, operator overloading, universal types, and iso-recursive types.