Laziness By Need.
Stephen Chang.
22nd European Symposium on Programming (ESOP 2013), Rome, Italy, March 2013.
[ PDF ]
Lazy functional programming has many benefits that strict functional languages can simulate via lazy data constructors. In recognition, ML, Scheme, and other strict functional languages have supported lazy stream programming with
delay
andforce
for several decades. Unfortunately, the manual insertion ofdelay
andforce
can be tedious and error-prone.We present a semantics-based refactoring that helps strict programmers manage manual lazy programming. The refactoring uses a static analysis to identify where additional
delay
s andforce
s might be needed to achieve the desired simplification and performance benefits, once the programmer has added the initial lazy data constructors. The paper presents a correctness argument for the underlying transformations and some preliminary experiences with a prototype tool implementation.