Simplifying explicit subtyping coercions in a polymorphic calculus with effects

📅 2024-04-05
🏛️ arXiv.org
📈 Citations: 0
Influential: 0
📄 PDF

career value

175K/year
🤖 AI Summary
Explicit subtyping coercions in algebraic effect handlers incur significant compilation overhead for polymorphic functions—particularly in effect-polymorphic systems, where coercions are compiled as additional function parameters. Method: We propose an effectful polymorphic calculus augmented with a constraint-simplification mechanism, integrated into an explicit-coercion λ-calculus framework based on algebraic effects and handlers. Contribution/Results: We formally define and prove the soundness of a coercion-simplification phase—the first such result for effect-polymorphic systems—that eliminates redundant coercions via semantics-preserving constraint reduction, avoiding full monomorphization. Implemented in the Eff language, our approach completely eliminates all coercions in benchmark programs, yielding generated code whose performance matches hand-written monomorphized code.

Technology Category

Application Category

📝 Abstract
Algebraic effect handlers are becoming increasingly popular way of structuring and reasoning about effectful computations, and their performance is often a concern. One of the proposed approaches towards efficient compilation is tracking effect information through explicit subtyping coercions. However, in the presence of polymorphism, these coercions are compiled to additional arguments of compiled functions, incurring significant overhead. In this paper, we present a polymorphic effectful calculus, identify simplification phases needed to reduce the number of unnecessary constraints, and prove they preserve the semantics. In addition, we implement the simplification algorithm in the Eff language, and evaluate its performance on a number of benchmarks. Though we do not prove optimality of presented simplifications, the results show that the algorithm eliminates all the coercions, resulting in a code as efficient as manually monomorphised one.
Problem

Research questions and friction points this paper is trying to address.

Reducing overhead from explicit subtyping coercions in polymorphic calculi
Simplifying effect constraints to improve compilation efficiency
Optimizing algebraic effect handlers for performance in polymorphic systems
Innovation

Methods, ideas, or system contributions that make the work stand out.

Simplifies polymorphic effectful calculus coercions
Reduces unnecessary constraints via simplification phases
Implements algorithm in Eff for coercion elimination
🔎 Similar Papers
No similar papers found.