Laziness By Need.
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
forcefor several decades. Unfortunately, the manual insertion of
forcecan 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
forces 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.