Handling Polymorphic Algebraic Effects

被引:6
|
作者
Sekiyama, Taro [1 ]
Igarashi, Atsushi [2 ]
机构
[1] Natl Inst Informat, Tokyo, Japan
[2] Kyoto Univ, Kyoto, Japan
关键词
HANDLERS;
D O I
10.1007/978-3-030-17184-1_13
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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 a naive combination of polymorphic effects and let-polymorphism breaks type safety. Although 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 that restricts handlers instead of let-bound expressions. Our key observation is that, informally speaking, 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 lambda(let)(eff) 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.
引用
收藏
页码:353 / 380
页数:28
相关论文
共 50 条
  • [1] HANDLING ALGEBRAIC EFFECTS
    Plotkin, Gordon D.
    Pretnar, Matija
    [J]. LOGICAL METHODS IN COMPUTER SCIENCE, 2013, 9 (04)
  • [2] Handling Fibred Algebraic Effects
    Ahman, Danel
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [3] Signature restriction for polymorphic algebraic effects
    Sekiyama, Taro
    Tsukada, Takeshi
    Igarashi, Atsushi
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2024, 34
  • [4] Signature Restriction for Polymorphic Algebraic Effects
    Sekiyama, Taro
    Tsukada, Takeshi
    Igarashi, Atsushi
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (ICFP):
  • [5] Specification and Verification for Unrestricted Algebraic Effects and Handling
    Song, Yahui
    Foo, Darius
    Chin, Wei-Ngan
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2024, 8 (ICFP):
  • [6] ALGEBRAIC SEMANTICS OF EXCEPTION HANDLING
    BERNOT, G
    BIDOIT, M
    CHOPPY, C
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1986, 213 : 173 - 186
  • [7] POLYMORPHIC REWRITING CONSERVES ALGEBRAIC CONFLUENCE
    BREAZUTANNEN, V
    GALLIER, J
    [J]. INFORMATION AND COMPUTATION, 1994, 114 (01) : 1 - 29
  • [8] An algebraic theory of polymorphic temporal media
    Hudak, P
    [J]. PRACTICAL ASPECTS OF DECLARATIVE LANGUAGES, 2004, 3057 : 1 - 15
  • [9] POLYMORPHIC REWRITING CONSERVES ALGEBRAIC STRONG NORMALIZATION
    BREAZUTANNEN, V
    GALLIER, J
    [J]. THEORETICAL COMPUTER SCIENCE, 1991, 83 (01) : 3 - 28
  • [10] Polymorphic dynamic programming by algebraic shortcut fusion
    Little, Max A.
    He, Xi
    Kayas, Ugur
    [J]. FORMAL ASPECTS OF COMPUTING, 2024, 36 (02)