🤖 AI Summary
This work addresses the problem of clarifying the fundamental relationship between row polymorphism and capability-based effect systems in effect tracking, and mitigating their excessive coupling with language features such as functions. To this end, we propose the first unified framework based on modal effect types, which decouples effect tracking from function abstraction to enable synergistic modeling of both mechanisms. Our approach combines macro translation with formal semantics, faithfully encoding several mainstream effect systems—including Koka, Eff, and F*—while preserving type safety and semantic consistency. The results demonstrate a deep correspondence between row polymorphism and capabilities in effect modeling. Moreover, the unified framework significantly enhances comparability, expressiveness, and design interpretability of effect systems, thereby providing both theoretical foundations and practical tools for effect system integration and novel language design.
📝 Abstract
Effect handlers allow programmers to model and compose computational effects modularly. Effect systems statically guarantee that all effects are handled. Several recent practical effect systems are based on either row polymorphism or capabilities. However, there remains a gap in understanding the precise relationship between effect systems with such disparate foundations. The main difficulty is that in both row-based and capability-based systems, effect tracking is typically entangled with other features such as functions.
We propose a uniform framework for encoding, analysing, and comparing effect systems. Our framework exploits and generalises modal effect types, a recent novel effect system which decouples effect tracking from functions via modalities. Modalities offer fine-grained control over when and how effects are tracked, enabling us to express different strategies for effect tracking. We give encodings as macro translations from existing row-based and capability-based effect systems into our framework and show that these encodings preserve types and semantics. Our encodings reveal the essence of effect tracking mechanisms in different effect systems, enable a direct analysis on their differences, and provide valuable insights on language design.