Compiling laziness using projections

  • Ross Paterson
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1145)


Projection-based strictness analysis is a powerful technique, able to cope with non-flat domains and latent demand. By analysing the projections as embedding-projection pairs, we develop an algorithm to translate lazy functions into a strict functional language with explicit closures. The translated functions typically operate on simpler types than the originals, in particular types containing fewer liftings, which correspond to the operational notion of closures. Like the analysis on which it is based, our algorithm is restricted to first-order functions.


Partial Function Source Language Functional Language Type Constructor Projection Component 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Torben Amtoft. Minimal thunkification. In Patrick Cousot et al., editors, Static Analysis: 3rd International Workshop, WSA '93, Padova, Italy, volume 724 of Lecture Notes in Computer Science, pages 218–229. Springer, 1993.Google Scholar
  2. 2.
    Andrew A. Appel. Compiling with Continuations. Cambridge University Press, 1992.Google Scholar
  3. 3.
    Geoffrey L. Burn, Chris Hankin, and Samson Abramsky. Strictness_analysis of higher order functions. Science of Computer Programming, 7:249–278, 1986.CrossRefGoogle Scholar
  4. 4.
    Geoffrey L. Burn and Daniel Le Métayer. Proving the correctness of compiler optimisations based on a global program analysis. In Fifth International Symposium on Programming Language Implementation and Logic Programming, volume 714 of Lecture Notes in Computer Science, pages 346–364, Tallinn, Estonia, August 1993. Springer.Google Scholar
  5. 5.
    W. Clinger and J. Rees. Revised4 report on the algorithmic language Scheme. ACM Lisp Pointers, IV, July–September 1991.Google Scholar
  6. 6.
    Olivier Danvy and John Hatcliff. CPS-transformation after strictness analysis. ACM Letters on Programming Languages and Systems, 1(3):195–212, 1992.Google Scholar
  7. 7.
    Kei Davis and Philip Wadler. Strictness analysis in 4D. In 1990 Glasgow Workshop on Functional Programming, Workshops in Computing, pages 23–43. Springer, 1991.Google Scholar
  8. 8.
    Karl-Filip Faxén. Optimizing lazy functional programs using flow inference. In Static Analysis, Second International Symposium, volume 983 of Lecture Notes in Computer Science, pages 136–153. Springer, 1995.Google Scholar
  9. 9.
    Karl-Filip Faxén. Flow inference, code generation and garbage collection for lazy functional languages. Licentiate thesis, Kungl Tekniska Högskolan, January 1996.Google Scholar
  10. 10.
    Cordelia V. Hall and David S. Wise. Compiling strictness into streams. In 14th ACM Symposium on Principles of Programming Languages, pages 132–143, Munich, January 1987.Google Scholar
  11. 11.
    Paul Hudak, Simon Peyton Jones, Philip Wadler, et al. Report on the programming language Haskell, a non-strict purely functional language (Version 1.2). SIGPLAN Notices, 27(5), March 1992.Google Scholar
  12. 12.
    Sebastian Hunt. Abstract Interpretation of Functional Languages: From Theory to Practice. PhD thesis, Imperial College of Science, Technology and Medicine, 1991.Google Scholar
  13. 13.
    Ryszard Kubiak, John Hughes, and John Launchbury. Implementing projectionbased strictness analysis. In 1991 Glasgow Workshop on Functional Programming, Workshops in Computing, pages 207–224. Springer, 1992.Google Scholar
  14. 14.
    T-M. Kuo and P. Mishra. Strictness analysis: A new perspective based on type inference. In FPCA '89, London, England, pages 260–272. ACM Press, September 1989.Google Scholar
  15. 15.
    John Launchbury and Gebreselassie Baraki. Representing demand by partial projections. Journal of Functional Programming, 6(4), 1996.Google Scholar
  16. 16.
    John Launchbury and Ross Paterson. Parametricity and unboxing with unpointed types. In European Symposium on Programming, volume 1058 of Lecture Notes in Computer Science, pages 204–218, Linköping, Sweden, April 1996.Google Scholar
  17. 17.
    Alan Mycroft. The theory and practice of transforming call-by-need into call-by-value. In B. Robinet, editor, International Symposium on Programming, volume 83 of Lecture Notes in Computer Science. Springer, 1980.Google Scholar
  18. 18.
    Simon L. Peyton Jones. Implementing lazy functional languages on stock hardware: the spineless tagless G-machine. Journal of Functional Programming, 2(2):127–202, July 1992.Google Scholar
  19. 19.
    Simon L. Peyton Jones and John Launchbury. Unboxed values as first class citizens in a non-strict functional language. In Conference on Functional Programming Languages and Computer Architecture, pages 636–666, Cambridge, MA, 1991.Google Scholar
  20. 20.
    Philip Wadler and John Hughes, Projections for strictness analysis. In Conference on Functional Programming Languages and Computer Architecture, volume 274 of Lecture Notes in Computer Science, Portland, OR, 1987.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Ross Paterson
    • 1
  1. 1.School of ComputingUniversity of North LondonLondonUK

Personalised recommendations