Handling polymorphic algebraic effects

11/18/2018
by   Taro Sekiyama, et al.
0

Algebraic effects and handlers are a powerful abstraction mechanism to represent and implement control effects. In this work, we study their extension with parametric polymorphism that allows abstracting not only expressions but also effects and handlers. Although polymorphism makes it possible to reuse and reason about effect implementations more effectively, it has long been known that naive combination of polymorphic effects and let-polymorphism breaks type safety. While type safety can often be gained by restricting let-bound expressions---e.g., by adopting value restriction or weak polymorphism---we propose a complementary approach, which restricts, instead of let-bound expressions, handlers. Our key observation is, informally speaking, that a handler is safe if resumptions from the handler do not interfere with each other. To formalize our idea, we define a call-by-value lambda calculus that supports let-polymorphism and polymorphic algebraic effects and handlers, design a type system that rejects interfering handlers, and prove type safety of our calculus.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/18/2020

Signature restriction for polymorphic algebraic effects

It has been well known that naively combining polymorphic effects and po...
research
10/14/2021

Parallel Algebraic Effect Handlers

Algebraic effects and handlers support composable and structured control...
research
04/19/2023

A Calculus for Scoped Effects Handlers

Algebraic effects handlers have become a standard approach for side-...
research
05/25/2021

Tracking Captured Variables in Types

Type systems usually characterize the shape of values but not their free...
research
02/02/2023

A Framework for the Automated Verification of Algebraic Effects and Handlers (extended version)

Algebraic effects and handlers are a powerful abstraction to build non-l...
research
07/25/2023

Higher-Order Asynchronous Effects

We explore asynchronous programming with algebraic effects. We complemen...
research
07/28/2023

Answer Refinement Modification: Refinement Type System for Algebraic Effects and Handlers

Algebraic effects and handlers are a mechanism to structure programs wit...

Please sign up or login with your details

Forgot password? Click here to reset