Hostname: page-component-6766d58669-bp2c4 Total loading time: 0 Render date: 2026-05-14T17:12:18.289Z Has data issue: false hasContentIssue false

Explicit effect subtyping

Published online by Cambridge University Press:  08 June 2020

GEORGIOS KARACHALIAS
Affiliation:
Department of Computer Science, KU Leuven, Belgium Tweag I/O (e-mail: georgios.karachalias@tweag.io)
MATIJA PRETNAR
Affiliation:
Faculty of Mathematics and Physics, University of Ljubljana, Slovenia (e-mail: matija.pretnar@fmf.uni-lj.si)
AMR HANY SALEH
Affiliation:
Department of Computer Science, KU Leuven, Belgium (e-mails: ah.saleh@kuleuven.be; stienvdhallen@gmail.com; tom.schrijvers@kuleuven.be)
STIEN VANDERHALLEN
Affiliation:
Department of Computer Science, KU Leuven, Belgium (e-mails: ah.saleh@kuleuven.be; stienvdhallen@gmail.com; tom.schrijvers@kuleuven.be)
TOM SCHRIJVERS
Affiliation:
Department of Computer Science, KU Leuven, Belgium (e-mails: ah.saleh@kuleuven.be; stienvdhallen@gmail.com; tom.schrijvers@kuleuven.be)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

As popularity of algebraic effects and handlers increases, so does a demand for their efficient execution. Eff, an ML-like language with native support for handlers, has a subtyping-based effect system on which an effect-aware optimising compiler could be built. Unfortunately, in our experience, implementing optimisations for Eff is overly error-prone because its core language is implicitly typed, making code transformations very fragile. To remedy this, we present an explicitly typed polymorphic core calculus for algebraic effect handlers with a subtyping-based type-and-effect system. It reifies appeals to subtyping in explicit casts with coercions that witness the subtyping proof, quickly exposing typing bugs in program transformations. Our typing-directed elaboration comes with a constraint-based inference algorithm that turns an implicitly typed Eff-like language into our calculus. Moreover, all coercions and effect information can be erased in a straightforward way, demonstrating that coercions have no computational content. Additionally, we present a monadic translation from our calculus into a pure language without algebraic effects or handlers, using the effect information to introduce monadic constructs only where necessary.

Information

Type
Research Article
Copyright
© The Author(s) 2020. Published by Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.