Union and intersection contracts are hard, actually
Teodoro Freund, Yann Hamdaoui, Arnaud Spiwack

TL;DR
This paper explores the complexities and challenges of implementing union and intersection contracts in gradually typed languages, especially with higher-order functions, highlighting underlying difficulties and trade-offs.
Contribution
It provides a detailed analysis and survey of the problems and trade-offs involved in higher-order union and intersection contracts, clarifying why they are difficult to verify.
Findings
Union and intersection contracts are deceptively complex with higher-order functions.
Existing literature recognizes the difficulty but lacks explanation of the core issues.
The paper illustrates problems through examples and literature survey.
Abstract
Union and intersection types are a staple of gradually typed language such as TypeScript. While it's long been recognized that union and intersection types are difficult to verify statically, it may appear at first that the dynamic part of gradual typing is actually pretty simple. It turns out however, that in presence of higher-order contracts union and intersection are deceptively difficult. The literature on higher-order contracts with union and intersection, while keenly aware of the fact, doesn't really explain why. We point and illustrate the problems and trade-offs inherent to union and intersection contracts, via example and a survey of the literature.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
