{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,8,18]],"date-time":"2026-08-18T14:40:50Z","timestamp":1787064050583,"version":"build-2736575974"},"reference-count":47,"publisher":"Association for Computing Machinery (ACM)","issue":"ICFP","license":[{"start":{"date-parts":[[2021,8,19]],"date-time":"2021-08-19T00:00:00Z","timestamp":1629331200000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2021,8,22]]},"abstract":"<jats:p>This paper studies compilation techniques for algebraic effect handlers. In particular, we present a sequence of refinements of algebraic effects, going via multi-prompt delimited control, _generalized evidence passing_, yield bubbling, and finally a monadic translation into plain lambda calculus which can be compiled efficiently to many target platforms. Along the way we explore various interesting points in the design space. We provide two implementations of our techniques, one as a library in Haskell, and one as a C backend for the Koka programming language. We show that our techniques are effective, by comparing against three other best-in-class implementations of effect handlers: multi-core OCaml, the _Ev.Eff_ Haskell library, and the libhandler C library. We hope this work can serve as a basis for future designs and implementations of algebraic effects.<\/jats:p>","DOI":"10.1145\/3473576","type":"journal-article","created":{"date-parts":[[2021,8,19]],"date-time":"2021-08-19T06:44:29Z","timestamp":1629355469000},"page":"1-30","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":18,"title":["Generalized evidence passing for effect handlers: efficient compilation of effect handlers to C"],"prefix":"10.1145","volume":"5","author":[{"given":"Ningning","family":"Xie","sequence":"first","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Daan","family":"Leijen","sequence":"additional","affiliation":[{"name":"Microsoft Research, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2021,8,19]]},"reference":[{"key":"e_1_2_2_1_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-76637-7_16"},{"key":"e_1_2_2_2_1","doi-asserted-by":"publisher","DOI":"10.1145\/581478.581494"},{"key":"e_1_2_2_3_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.jlamp.2014.02.001"},{"key":"e_1_2_2_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/3428194"},{"key":"e_1_2_2_5_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796820000027"},{"key":"e_1_2_2_6_1","volume-title":"A Functional Abstraction of Typed Contexts. DIKU","author":"Danvy Olivier"},{"key":"e_1_2_2_7_1","volume-title":"Effectively Tackling the Awkward Squad. In ML Workshop.","author":"Dolan Stephen","year":"2017"},{"key":"e_1_2_2_8_1","volume-title":"OCaml Workshop.","author":"Dolan Stephen","year":"2015"},{"key":"e_1_2_2_9_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006259"},{"key":"e_1_2_2_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/3385412.3385994"},{"key":"e_1_2_2_11_1","volume-title":"Proceedings of the 1st Symposium on Logic in Computer Science (LICS). 131\u2013141","author":"Felleisen Matthias"},{"key":"e_1_2_2_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/3385412.3385981"},{"key":"e_1_2_2_13_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796819000121"},{"key":"e_1_2_2_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/224164.224173"},{"key":"e_1_2_2_15_1","doi-asserted-by":"publisher","DOI":"10.1145\/3062341.3062363"},{"key":"e_1_2_2_16_1","volume-title":"Shallow Effect Handlers. In 16th Asian Symposium on Programming Languages and Systems (APLAS\u201918)","author":"Hillerstr\u00f6m Daniel","year":"2018"},{"key":"e_1_2_2_17_1","volume-title":"Proceedings of the second International Conference on Formal Structures for Computation and Deduction (FSCD\u201917)","author":"Hillerstr Daniel","year":"2017"},{"key":"e_1_2_2_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/2976022.2976033"},{"key":"e_1_2_2_19_1","doi-asserted-by":"publisher","DOI":"10.1145\/2500365.2500590"},{"key":"e_1_2_2_20_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796816000320"},{"key":"e_1_2_2_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/2804302.2804319"},{"key":"e_1_2_2_22_1","doi-asserted-by":"publisher","DOI":"10.1145\/1159803.1159808"},{"key":"e_1_2_2_23_1","volume-title":"ML workshop","author":"Kiselyov Oleg","year":"2017"},{"key":"e_1_2_2_24_1","volume-title":"Proceedings of the 2005 Symposium on Trends in Functional Programming. 297\u2013312","author":"Leijen Daan","year":"2005"},{"key":"e_1_2_2_25_1","first-page":"339","article-title":"Implementing Algebraic Effects in C: or Monads for free in C","volume":"10695","author":"Leijen Daan","year":"2017","journal-title":"Programming Languages and Systems"},{"key":"e_1_2_2_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/3009837.3009872"},{"key":"e_1_2_2_27_1","unstructured":"Daan Leijen. 2020. The Koka Programming Language. Nov. https:\/\/koka-lang.github.io  Daan Leijen. 2020. The Koka Programming Language. Nov. https:\/\/koka-lang.github.io"},{"key":"e_1_2_2_28_1","unstructured":"Daan Leijen. 2021. Effect Handler Benchmarks. May https:\/\/github.com\/daanx\/effect-bench  Daan Leijen. 2021. Effect Handler Benchmarks. May https:\/\/github.com\/daanx\/effect-bench"},{"key":"e_1_2_2_29_1","doi-asserted-by":"publisher","DOI":"10.1007\/s10990-006-0480-6"},{"key":"e_1_2_2_30_1","unstructured":"Michel Parigot. 1992. &lambda;&mu;-Calculus: An algorithmic interpretation of classical natural deduction. In Logic Programming and Automated Reasoning Andrei Voronkov (Ed.). Springer Berlin Heidelberg 190\u2013201. isbn:978-3-540-47279-7  Michel Parigot. 1992. &lambda;&mu;-Calculus: An algorithmic interpretation of classical natural deduction. In Logic Programming and Automated Reasoning Andrei Voronkov (Ed.). Springer Berlin Heidelberg 190\u2013201. isbn:978-3-540-47279-7"},{"key":"e_1_2_2_31_1","doi-asserted-by":"publisher","DOI":"10.1023\/A:1023064908962"},{"key":"e_1_2_2_32_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-00590-9_7"},{"key":"e_1_2_2_33_1","doi-asserted-by":"publisher","DOI":"10.2168\/LMCS-9(4:23)2013"},{"key":"e_1_2_2_34_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.entcs.2015.12.003"},{"key":"e_1_2_2_35_1","volume-title":"Perceus: Garbage Free Reference Counting with Reuse. In 42rd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI \u201921)","author":"Reinking Alex","year":"2021"},{"key":"e_1_2_2_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/3331545.3342595"},{"key":"e_1_2_2_37_1","doi-asserted-by":"publisher","DOI":"10.1145\/3408975"},{"key":"e_1_2_2_38_1","volume-title":"42rd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI \u201921)","author":"Sivaramakrishnan KC","year":"2021"},{"key":"e_1_2_2_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/1190315.1190324"},{"key":"e_1_2_2_40_1","unstructured":"Herb Sutter. 2019. Zero-overhead deterministic exceptions: Throwing values. http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p0709r4.pdf ISO\/IEC WG2.1 P0709R4.  Herb Sutter. 2019. Zero-overhead deterministic exceptions: Throwing values. http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p0709r4.pdf ISO\/IEC WG2.1 P0709R4."},{"key":"e_1_2_2_41_1","volume-title":"Proceedings of the 12th International Conference on Mathematics of Program Construction (MPC","volume":"302","author":"Wu Nicolas","year":"2015"},{"key":"e_1_2_2_42_1","doi-asserted-by":"publisher","DOI":"10.1145\/2633357.2633358"},{"key":"e_1_2_2_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/3408981"},{"key":"e_1_2_2_44_1","doi-asserted-by":"publisher","DOI":"10.1145\/3406088.3409022"},{"key":"e_1_2_2_45_1","unstructured":"Ningning Xie and Daan Leijen. 2021. Generalized Evidence Passing for Effect Handlers. Microsoft Research. Extended version with proofs.  Ningning Xie and Daan Leijen. 2021. Generalized Evidence Passing for Effect Handlers. Microsoft Research. Extended version with proofs."},{"key":"e_1_2_2_46_1","unstructured":"Ningning Xie and Daan Leijen. 2021. Mp.Eff: Efficient effect handlers based on Evidence Passing Semantics. March https:\/\/github.com\/xnning\/MpEff  Ningning Xie and Daan Leijen. 2021. Mp.Eff: Efficient effect handlers based on Evidence Passing Semantics. March https:\/\/github.com\/xnning\/MpEff"},{"key":"e_1_2_2_47_1","doi-asserted-by":"publisher","DOI":"10.1145\/3290318"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3473576","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3473576","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T17:28:15Z","timestamp":1750181295000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3473576"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2021,8,19]]},"references-count":47,"journal-issue":{"issue":"ICFP","published-print":{"date-parts":[[2021,8,22]]}},"alternative-id":["10.1145\/3473576"],"URL":"https:\/\/doi.org\/10.1145\/3473576","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2021,8,19]]},"assertion":[{"value":"2021-08-19","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}