Lune

OOPSLA2023Top-tier venue

Live Pattern Matching with Typed Holes

Yongwei Yuan, Scott Guest, Eric Griffis, Hannah Potter, David Moon, Cyrus Omar

Abstract

Several modern programming systems, including GHC Haskell, Agda, Idris, and Hazel, support typed holes . Assigning static and, to varying degree, dynamic meaning to programs with holes allows program editors and other tools to offer meaningful feedback and assistance throughout editing, i.e. in a live manner. Prior work, however, has considered only holes appearing in expressions and types. This paper considers, from type theoretic and logical first principles, the problem of typed pattern holes. We confront two main difficulties, (1) statically reasoning about exhaustiveness and irredundancy when patterns are not fully known, and (2) live evaluation of expressions containing both pattern and expression holes. In both cases, this requires reasoning conservatively about all possible hole fillings. We develop a typed lambda calculus, Peanut, where reasoning about exhaustiveness and redundancy is mapped to the problem of deriving first order entailments. We equip Peanut with an operational semantics in the style of Hazelnut Live that allows us to evaluate around holes in both expressions and patterns. We mechanize the metatheory of Peanut in Agda and formalize a procedure capable of deciding the necessary entailments. Finally, we scale up and implement these mechanisms within Hazel, a programming environment for a dialect of Elm that automatically inserts holes during editing to provide static and dynamic feedback to the programmer in a maximally live manner, i.e. for every possible editor state. Hazel is the first maximally live environment for a general-purpose functional language.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Statically Contextualizing Large Language Models with Typed Holes cites Total Type Error Localization and Recovery with Holes
  • Incremental Certified Programming cites Total Type Error Localization and Recovery with Holes
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Total Type Error Localization and Recovery with HolesEric Zhao, Raef Maroof, Anand Dukkipati, Andrew Blinn et al.POPL 2024 · 15 citations
  2. Statically Contextualizing Large Language Models with Typed HolesAndrew Blinn, Xiang Li, June Hyung Kim, Cyrus OmarOOPSLA 2024 · 10 citations
  3. Incremental Certified ProgrammingTomás Díaz, Kenji Maillard, Nicolas Tabareau, Éric TanterOOPSLA 2025

Builds on1

  1. Gradually structured dataStefan Malewski, Michael Greenberg, Éric TanterOOPSLA 2021 · 4 citations

Related papers

  1. Filling typed holes with live GUIsCyrus Omar, David Moon, Andrew Blinn, Ian Voysey et al.PLDI 2021 · 35 citations
  2. Interactive Data Analysis with Lively Typed TablesAlexander Bandukwala, Cyrus OmarOOPSLA 2026
  3. Incremental Bidirectional Typing via Order MaintenanceThomas Porter, Marisa Kirisame, Ivan Wei, Pavel Panchekha et al.OOPSLA 2025 · 2 citations
  4. Type Inference LogicsDenis Carnier, François Pottier, Steven KeuchelOOPSLA 2024 · 3 citations
  5. Intensional datatype refinement: with application to scalable verification of pattern-match safetyEddie Jones, Steven J. RamsayPOPL 2021 · 3 citations
Dusk over the sea between two cliffs drawn in fine vertical lines