Latent Effects for Reusable Language Components: Extended Version

08/25/2021
by   Birthe van den Berg, et al.
0

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.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

10/18/2020

Handling Bidirectional Control Flow: Technical Report

Pressed by the difficulty of writing asynchronous, event-driven code, ma...
07/22/2021

Fundamental Constructs in Programming Languages

Specifying the semantics of a programming language formally can have man...
05/16/2019

First-Class Subtypes

First class type equalities, in the form of generalized algebraic data t...
12/31/2018

Eff Directly in OCaml

The language Eff is an OCaml-like language serving as a prototype implem...
04/01/2021

Retrofitting Effect Handlers onto OCaml

Effect handlers have been gathering momentum as a mechanism for modular ...
08/03/2021

Localisable Monads

Monads govern computational side-effects in programming semantics. They ...
07/01/2020

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.