{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,6,9]],"date-time":"2026-06-09T08:45:42Z","timestamp":1780994742029,"version":"3.54.1"},"reference-count":50,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA2","license":[{"start":{"date-parts":[[2022,10,31]],"date-time":"2022-10-31T00:00:00Z","timestamp":1667174400000},"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":[[2022,10,31]]},"abstract":"<jats:p>Algebraic effects and handlers are a promising technique for incorporating composable computational effects into functional programming languages. Effect handlers enable concisely programming with different effects, but they do not offer a convenient way to program with different instances of the same effect. As a solution to this inconvenience, previous studies have introduced _named effect handlers_, which allow the programmer to distinguish among different effect instances. However, existing formalizations of named handlers are both involved and restrictive, as they employ non-standard mechanisms to prevent the escaping of handler names.<\/jats:p>\n          <jats:p>In this paper, we propose a simple and flexible design of named handlers. Specifically, we treat handler names as first-class values, and prevent their escaping while staying within the ordinary \u03bb-calculus. Such a design is enabled by combining named handlers with _scoped effects_, a novel variation of effects that maintain a scope via rank-2 polymorphism. We formalize two combinations of named handlers and scoped effects, and implement them in the Koka programming language. We also present practical applications of named handlers, including a neural network and a unification algorithm.<\/jats:p>","DOI":"10.1145\/3563289","type":"journal-article","created":{"date-parts":[[2022,10,31]],"date-time":"2022-10-31T20:23:35Z","timestamp":1667247815000},"page":"30-59","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":8,"title":["First-class names for effect handlers"],"prefix":"10.1145","volume":"6","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-5961-1493","authenticated-orcid":false,"given":"Ningning","family":"Xie","sequence":"first","affiliation":[{"name":"University of Cambridge, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-2315-6182","authenticated-orcid":false,"given":"Youyou","family":"Cong","sequence":"additional","affiliation":[{"name":"Tokyo Institute of Technology, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-4452-6592","authenticated-orcid":false,"given":"Kazuki","family":"Ikemori","sequence":"additional","affiliation":[{"name":"Tokyo Institute of Technology, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-1027-5430","authenticated-orcid":false,"given":"Daan","family":"Leijen","sequence":"additional","affiliation":[{"name":"Microsoft Research, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2022,10,31]]},"reference":[{"key":"e_1_2_1_1_1","volume-title":"An Effect System for Algebraic Effects and Handlers. Logical Methods in Computer Science, 10, 4","author":"Bauer Andrej","year":"2014","unstructured":"Andrej Bauer and Matija Pretnar . 2014. An Effect System for Algebraic Effects and Handlers. Logical Methods in Computer Science, 10, 4 ( 2014 ). Andrej Bauer and Matija Pretnar. 2014. An Effect System for Algebraic Effects and Handlers. Logical Methods in Computer Science, 10, 4 (2014)."},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.jlamp.2014.02.001"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/3158096"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/3371116"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.5555\/3322706.3322734"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.1145\/3236762"},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.1145\/3428194"},{"key":"e_1_2_1_8_1","doi-asserted-by":"crossref","unstructured":"Lukas Convent Sam Lindley Conor McBride and Craig McLaughlin. 2020. Doo bee doo bee doo. In the Journal of Functional Programming Jan.. \t\t\t\t  Lukas Convent Sam Lindley Conor McBride and Craig McLaughlin. 2020. Doo bee doo bee doo. In the Journal of Functional Programming Jan..","DOI":"10.1017\/S0956796820000039"},{"key":"e_1_2_1_9_1","volume-title":"Effectively Tackling the Awkward Squad. In ML Workshop.","author":"Dolan Stephen","year":"2017","unstructured":"Stephen Dolan , Spiros Eliopoulos , Daniel Hillerstr\u00f6m , Anil Madhavapeddy , KC Sivaramakrishnan , and Leo White . 2017 . Effectively Tackling the Awkward Squad. In ML Workshop. Stephen Dolan, Spiros Eliopoulos, Daniel Hillerstr\u00f6m, Anil Madhavapeddy, KC Sivaramakrishnan, and Leo White. 2017. Effectively Tackling the Awkward Squad. In ML Workshop."},{"key":"e_1_2_1_10_1","volume-title":"POPL 2018","author":"Dreyer Derek","year":"2018","unstructured":"Derek Dreyer . 2018 . The Type Soundness Theorem That You Really Want to Prove (and now you can). Milner Award Lecture , POPL 2018 Derek Dreyer. 2018. The Type Soundness Theorem That You Really Want to Prove (and now you can). Milner Award Lecture, POPL 2018"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006259"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796819000121"},{"key":"e_1_2_1_13_1","volume-title":"Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA \u201995)","author":"Gunter Carl A.","unstructured":"Carl A. Gunter , Didier R\u00e9my , and Jon G. Riecke . 1995. A Generalization of Exceptions and Control in ML-like Languages . In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA \u201995) . ACM, 12\u201323. isbn:0897917197 Carl A. Gunter, Didier R\u00e9my, and Jon G. Riecke. 1995. A Generalization of Exceptions and Control in ML-like Languages. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA \u201995). ACM, 12\u201323. isbn:0897917197"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/2976022.2976033"},{"key":"e_1_2_1_15_1","volume-title":"The Fun of Programming, Cornerstones of Computing, eremy Gibbons and Oege de Moor (Eds.)","author":"Hinze Ralf","unstructured":"Ralf Hinze . 2003. Fun with phantom types . In The Fun of Programming, Cornerstones of Computing, eremy Gibbons and Oege de Moor (Eds.) . Palgrave Macmillan , 245\u2013262. isbn:1-4039-0772-2 Ralf Hinze. 2003. Fun with phantom types. In The Fun of Programming, Cornerstones of Computing, eremy Gibbons and Oege de Moor (Eds.). Palgrave Macmillan, 245\u2013262. isbn:1-4039-0772-2"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/237721.237731"},{"key":"e_1_2_1_17_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796816000320"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/1159803.1159808"},{"key":"e_1_2_1_19_1","volume-title":"ML workshop","author":"Kiselyov Oleg","year":"2017","unstructured":"Oleg Kiselyov and KC Sivaramakrishnan . 2017 . Eff directly in OCaml . In ML workshop 2016. http:\/\/kcsrk.info\/papers\/caml-eff17.pdf Extended version Oleg Kiselyov and KC Sivaramakrishnan. 2017. Eff directly in OCaml. In ML workshop 2016. http:\/\/kcsrk.info\/papers\/caml-eff17.pdf Extended version"},{"key":"e_1_2_1_20_1","unstructured":"Koka. 2019. https:\/\/github.com\/koka-lang\/koka \t\t\t\t  Koka. 2019. https:\/\/github.com\/koka-lang\/koka"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/1411204.1411245"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.4204\/EPTCS.153.8"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3009837.3009872"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/3240719.3241789"},{"key":"e_1_2_1_25_1","volume-title":"Domain Specific Embedded Compilers. In In proceedings of the 2nd conference on domain specific languages. 109\u2013122","author":"Leijen Daan","year":"1999","unstructured":"Daan Leijen and Erik Meijer . 1999 . Domain Specific Embedded Compilers. In In proceedings of the 2nd conference on domain specific languages. 109\u2013122 . Daan Leijen and Erik Meijer. 1999. Domain Specific Embedded Compilers. In In proceedings of the 2nd conference on domain specific languages. 109\u2013122."},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/3009837.3009897"},{"key":"e_1_2_1_27_1","series-title":"Lecture Notes in Computer Science (Semantics of Data Types","volume-title":"The typechecking of programs with implicit type structure","unstructured":"McCracken. 1984. The typechecking of programs with implicit type structure . In Lecture Notes in Computer Science (Semantics of Data Types , Vol. 173). McCracken. 1984. The typechecking of programs with implicit type structure. In Lecture Notes in Computer Science (Semantics of Data Types, Vol. 173)."},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1007\/BF01018827"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.1023\/A:1023064908962"},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-00590-9_7"},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.2168\/LMCS-9(4:23)2013"},{"key":"e_1_2_1_32_1","unstructured":"Matija Pretnar. 2010. Logic and handling of algebraic effects. Ph. D. Dissertation. \t\t\t\t  Matija Pretnar. 2010. Logic and handling of algebraic effects. Ph. D. Dissertation."},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.entcs.2015.12.003"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/3453483.3454032"},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-17184-1_13"},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/317636.317777"},{"key":"e_1_2_1_37_1","doi-asserted-by":"publisher","DOI":"10.1007\/s10990-007-9010-4"},{"key":"e_1_2_1_38_1","volume-title":"The ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM \u201921)","author":"Sigal Jesse","year":"2021","unstructured":"Jesse Sigal . 2021 . Automatic Differentiation via Effects and Handlers: An Implementation in Frank . In The ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM \u201921) . Jesse Sigal. 2021. Automatic Differentiation via Effects and Handlers: An Implementation in Frank. In The ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM \u201921)."},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/155090.155104"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-37036-6_14"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/3158152"},{"key":"e_1_2_1_42_1","volume-title":"Region-based memory management. Information and computation, 132, 2","author":"Tofte Mads","year":"1997","unstructured":"Mads Tofte and Jean-Pierre Talpin . 1997. Region-based memory management. Information and computation, 132, 2 ( 1997 ), 109\u2013176. Mads Tofte and Jean-Pierre Talpin. 1997. Region-based memory management. Information and computation, 132, 2 (1997), 109\u2013176."},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/3341700"},{"key":"e_1_2_1_44_1","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1994.1093"},{"key":"e_1_2_1_45_1","doi-asserted-by":"publisher","DOI":"10.1145\/2633357.2633358"},{"key":"e_1_2_1_46_1","volume-title":"Evidently. In Proceedings of the 25th ACM SIGPLAN International Conference on Functional Programming (ICFP\u20192020)","author":"Xie Ningning","year":"2020","unstructured":"Ningning Xie , Jonathan Brachth\u00e4user , Phillip Schuster , Daniel Hillerstr\u00f6m , and Daan Leijen . 2020 . Effect Handlers , Evidently. In Proceedings of the 25th ACM SIGPLAN International Conference on Functional Programming (ICFP\u20192020) (ICFP \u201920). Ningning Xie, Jonathan Brachth\u00e4user, Phillip Schuster, Daniel Hillerstr\u00f6m, and Daan Leijen. 2020. Effect Handlers, Evidently. In Proceedings of the 25th ACM SIGPLAN International Conference on Functional Programming (ICFP\u20192020) (ICFP \u201920)."},{"key":"e_1_2_1_47_1","doi-asserted-by":"publisher","DOI":"10.5281\/zenodo.7062933"},{"key":"e_1_2_1_48_1","volume-title":"Evidently. In Proceedings of the 2020 ACM SIGPLAN Symposium on Haskell (Haskell\u201920)","author":"Xie Ningning","year":"2020","unstructured":"Ningning Xie and Daan Leijen . 2020 . Effect Handlers in Haskell , Evidently. In Proceedings of the 2020 ACM SIGPLAN Symposium on Haskell (Haskell\u201920) . Ningning Xie and Daan Leijen. 2020. Effect Handlers in Haskell, Evidently. In Proceedings of the 2020 ACM SIGPLAN Symposium on Haskell (Haskell\u201920)."},{"key":"e_1_2_1_49_1","doi-asserted-by":"publisher","DOI":"10.1145\/3473576"},{"key":"e_1_2_1_50_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\/3563289","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3563289","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T16:38:10Z","timestamp":1750178290000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3563289"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2022,10,31]]},"references-count":50,"journal-issue":{"issue":"OOPSLA2","published-print":{"date-parts":[[2022,10,31]]}},"alternative-id":["10.1145\/3563289"],"URL":"https:\/\/doi.org\/10.1145\/3563289","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2022,10,31]]},"assertion":[{"value":"2022-10-31","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}