2023 Volume 40 Issue 2 Pages 2_19-2_48
Algebraic effects and handlers, which abstract effect occurrences in programs and define their behaviors in the handlers, enable programmers to clearly write effectful programs thanks to the separation of effect implementations. Trace effects, which statically estimate the order of events occurring during program executions, enable temporal property verification of programs. In this paper, we propose a type-and-effect system where algebraic effect handlers and trace effects coexist, with which we can capture temporal properties of the program while enjoying the ability of algebraic effect handlers to separate effect implementations. Also, we show the type safety of the type-and-effect system, which states that evaluations of well-typed terms do not get stuck and that trace effects of terms derived by the type-checking conservatively estimate event traces which possibly occur during the evaluations of the terms. We also construct a sound type inference algorithm for the proposed system.