,
Hugo Paquet
Creative Commons Attribution 4.0 International license
A lazy program interpreter postpones computation until the result is actually needed. This is typically more efficient than an eager (or call-by-value) interpreter, but a concern is that the semantics is not generally preserved. We propose a new semantic analysis of lazy evaluation that relies on a subtle combination of name generation and read-only state. Our perspective is that laziness arises from a hybrid evaluation strategy, in which only the name generation follows call-by-value. This semantic model suggests better intermediate representations of sum and product types in a lazy interpreter, along with equations that justify further optimizations. We illustrate this with an implementation in OCaml. Our motivation is practical: the origin of this work is a real-world application of discrete probabilistic programming, in which large algebraic data types cause significant performance issues with a call-by-value interpreter. Our lazy semantics justifies better optimized representations, and provides principled foundations for other methods involving laziness in probabilistic programming.
@InProceedings{castellan_et_al:LIPIcs.LICS.2026.25,
author = {Castellan, Simon and Paquet, Hugo},
title = {{Lazy Intermediate Representations for Algebraic Effects}},
booktitle = {41st Annual Symposium on Logic in Computer Science (LICS 2026)},
pages = {25:1--25:27},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-434-5},
ISSN = {1868-8969},
year = {2026},
volume = {380},
editor = {Faggian, Claudia and Katoen, Joost-Pieter},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.LICS.2026.25},
URN = {urn:nbn:de:0030-drops-268124},
doi = {10.4230/LIPIcs.LICS.2026.25},
annote = {Keywords: Categorical semantics, lazy evaluation, interpreter, probabilistic programming}
}