# Revisiting Occurrence Typing

**Authors:** Giuseppe Castagna, Victor Lanvin, Micka\"el Laurent, Kim Nguyen

arXiv: 1907.05590 · 2022-02-25

## TL;DR

This paper revisits occurrence typing, enhancing it with set-theoretic types to create a unified framework that improves type inference, supports intersection types, and optimizes compilation in gradually typed languages.

## Contribution

It introduces a general set-theoretic type framework for occurrence typing, unifying and extending existing approaches and enabling new applications.

## Key findings

- Develops a comprehensive set-theoretic occurrence typing framework
- Enables reconstruction of intersection types for unannotated functions
- Improves compilation efficiency for gradually typed languages

## Abstract

We revisit occurrence typing, a technique to refine the type of variables occurring in type-cases and, thus, capturesome programming patterns used in untyped languages. Although occurrence typing was tied from its inceptionto set-theoretic types-union types, in particular-it never fully exploited the capabilities of these types. Here weshow how, by using set-theoretic types, it is possible to develop a general typing framework that encompasses andgeneralizes several aspects of current occurrence typing proposals and that can be applied to tackle other problemssuch as the reconstruction of intersection types for unannotated or partially annotated functions and the optimizationof the compilation of gradually typed languages.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1907.05590/full.md

## Figures

10 figures with captions in the complete paper: https://tomesphere.com/paper/1907.05590/full.md

---
Source: https://tomesphere.com/paper/1907.05590