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

page 1

page 2

page 3

page 4

research
10/18/2020

Handling Bidirectional Control Flow: Technical Report

Pressed by the difficulty of writing asynchronous, event-driven code, ma...
research
02/02/2023

A Framework for Higher-Order Effects Handlers

Algebraic effects handlers are a modular approach for modeling side-...
research
04/19/2023

A Calculus for Scoped Effects Handlers

Algebraic effects handlers have become a standard approach for side-...
research
11/03/2022

Grounding Game Semantics in Categorical Algebra

I present a formal connection between algebraic effects and game semanti...
research
05/16/2019

First-Class Subtypes

First class type equalities, in the form of generalized algebraic data t...
research
07/17/2023

Modular Denotational Semantics for Effects with Guarded Interaction Trees

We present guarded interaction trees – a structure and a fully formalize...
research
11/25/2002

Monadic Style Control Constructs for Inference Systems

Recent advances in programming languages study and design have establish...

Please sign up or login with your details

Forgot password? Click here to reset