A Direct-Style Effect Notation for Sequential and Parallel Programs

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Richter, David, Böhler, Timon, Weisenburger, Pascal, Mezini, Mira
Format: Preprint
Publié: 2023
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866916317868589056
author Richter, David
Böhler, Timon
Weisenburger, Pascal
Mezini, Mira
author_facet Richter, David
Böhler, Timon
Weisenburger, Pascal
Mezini, Mira
contents Modeling sequential and parallel composition of effectful computations has been investigated in a variety of languages for a long time. In particular, the popular do-notation provides a lightweight effect embedding for any instance of a monad. Idiom bracket notation, on the other hand, provides an embedding for applicatives. First, while monads force effects to be executed sequentially, ignoring potential for parallelism, applicatives do not support sequential effects. Composing sequential with parallel effects remains an open problem. This is even more of an issue as real programs consist of a combination of both sequential and parallel segments. Second, common notations do not support invoking effects in direct-style, instead forcing a rigid structure upon the code. In this paper, we propose a mixed applicative/monadic notation that retains parallelism where possible, but allows sequentiality where necessary. We leverage a direct-style notation where sequentiality or parallelism is derived from the structure of the code. We provide a mechanisation of our effectful language in Coq and prove that our compilation approach retains the parallelism of the source program.
format Preprint
id arxiv_https___arxiv_org_abs_2305_08496
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle A Direct-Style Effect Notation for Sequential and Parallel Programs
Richter, David
Böhler, Timon
Weisenburger, Pascal
Mezini, Mira
Programming Languages
Modeling sequential and parallel composition of effectful computations has been investigated in a variety of languages for a long time. In particular, the popular do-notation provides a lightweight effect embedding for any instance of a monad. Idiom bracket notation, on the other hand, provides an embedding for applicatives. First, while monads force effects to be executed sequentially, ignoring potential for parallelism, applicatives do not support sequential effects. Composing sequential with parallel effects remains an open problem. This is even more of an issue as real programs consist of a combination of both sequential and parallel segments. Second, common notations do not support invoking effects in direct-style, instead forcing a rigid structure upon the code. In this paper, we propose a mixed applicative/monadic notation that retains parallelism where possible, but allows sequentiality where necessary. We leverage a direct-style notation where sequentiality or parallelism is derived from the structure of the code. We provide a mechanisation of our effectful language in Coq and prove that our compilation approach retains the parallelism of the source program.
title A Direct-Style Effect Notation for Sequential and Parallel Programs
topic Programming Languages
url https://arxiv.org/abs/2305.08496