Associated Effects: Flexible Abstractions for Effectful Programming

Research output: Contribution to journal/Conference contribution in journal/Contribution to newspaperJournal articleResearchpeer-review

Abstract

We present associated effects, a programming language feature that enables type classes to abstract over the effects of their function signatures, allowing each type class instance to specify its concrete effects. Associated effects significantly increase the flexibility and expressive power of a programming language that combines a type and effect system with type classes. In particular, associated effects allow us to (i) abstract over total and partial functions, where partial functions may throw exceptions, (ii) abstract over immutable data structures and mutable data structures that have heap effects, and (iii) implement adaptors that combine type classes with algebraic effects. We implement associated effects as an extension of the Flix programming language and refactor the Flix Standard Library to use associated effects, significantly increasing its flexibility and expressive power. Specifically, we add associated effects to 11 type classes, which enables us to add 28 new type class instances.

Original languageEnglish
Article number163
JournalProceedings of the ACM on Programming Languages
Volume8
ISSN2475-1421
DOIs
Publication statusPublished - Jun 2024

Keywords

  • ad-hoc polymorphism
  • associated effects
  • associated types
  • effect systems
  • generic programming
  • type classes
  • type functions

Fingerprint

Dive into the research topics of 'Associated Effects: Flexible Abstractions for Effectful Programming'. Together they form a unique fingerprint.

Cite this