đ¤ AI Summary
This paper addresses the challenge of modularly composing recursive functions over extensible data types. We propose a novel formal framework based on bounded algebras and Mendler-style recursion. Central to our approach is the row-typed RĪÎŧ type system, which uniformly models both recursive types and terms, enabling dynamic, type-safe composition of types and functions while automatically adapting recursive calls to newly added variants. We mechanize the metatheory in Agda, formally verifying type safety and expressive completeness. To our knowledge, this is the first formal treatment that achieves compositional, type-safe definition of recursive functions over extensible types. Our framework provides a rigorous algebraic semantic foundation and practical construction principles for modular language design.
đ Abstract
We explore recursive programming with extensible data types. Row types make the structure of data types first class, and can express a variety of type system features from subtyping to modular combination of case branches. Our goal is the modular combination of recursive types and of recursive functions over them. The most significant challenge is in recursive function calls, which may need to account for new cases in a combined type. We introduce bounded algebras, Mendler-style descriptions of recursive functions in which recursive calls can happen at larger types, and show that they provide expressive recursion over extensible data types. We formalize our approach in R$omegamu$, a small extension of an existing row type theory with support for recursive terms and types, and mechanize the metatheory of R$omegamu$ via an embedding in Agda