Latent Effects for Reusable Language Components: Extended Version

by   Birthe van den Berg, et al.

The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based "datatypes a la carte" (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.



There are no comments yet.


page 1

page 2

page 3

page 4


Handling Bidirectional Control Flow: Technical Report

Pressed by the difficulty of writing asynchronous, event-driven code, ma...

Fundamental Constructs in Programming Languages

Specifying the semantics of a programming language formally can have man...

First-Class Subtypes

First class type equalities, in the form of generalized algebraic data t...

Eff Directly in OCaml

The language Eff is an OCaml-like language serving as a prototype implem...

Retrofitting Effect Handlers onto OCaml

Effect handlers have been gathering momentum as a mechanism for modular ...

Localisable Monads

Monads govern computational side-effects in programming semantics. They ...

Effects for Efficiency: Asymptotic Speedup with First-Class Control

We study the fundamental efficiency of delimited control. Specifically, ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.