The Calculated Typer (Functional Pearl)
We present a calculational approach to the design of type checkers, showing how they can be derived from behavioural specifications using equational reasoning. We focus on languages whose semantics can be expressed as a fold, and show how the calculations can be simplified using fold fusion. This approach enables the compositional derivation of correct-by-construction type checkers based on solving and composing fusion preconditions. We introduce our approach using a simple expression language, to which we then add support for exception handling and checked exceptions.
Authors
- Patrick Bahr (ORCID: https://orcid.org/0000-0003-1600-8261)
- Graham Hutton (ORCID: https://orcid.org/0000-0001-9584-5150)
- Zac Garby (ORCID: https://orcid.org/0009-0007-3441-3646)
Institutions
- University of Nottingham (GB)
- IT University of Copenhagen (DK)
Publication Details
- Published
- 2025-10-09
- DOI
- https://doi.org/10.1145/3759164.3759346
- Primary Topic
- Logic, programming, and type systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Engineering and Physical Sciences Research Council