Advertisement

Type-Inference Based Short Cut Deforestation (Nearly) without Inlining

  • Olaf Chitil
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1868)

Abstract

Deforestation optimises a functional program by transforming it into another one that does not create certain intermediate data structures. Our type-inference based deforestation algorithm performs extensive inlining, but only limited inlining across module boundaries is practically feasible. Therefore we here present a type-inference based algorithm that splits a function definition into a worker definition and a wrapper definition. For deforestation we only need to inline the small wrappers which transfer the required information. We show that we even can deforest definitions of functions that consume their own result with the worker/wrapper scheme, in contrast to the original algorithm with inlining.

Keywords

Type Variable Fusion Rule Recursive Call Functional Program Module Boundary 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Chitil, O.: Type inference builds a short cut to deforestation. ACM SIGPLAN Notices 34(9), 249–260 (1999); Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 1999)Google Scholar
  2. 2.
    Damas, L., Milner, R.: Principal type-schemes for functional programs. In: Conference Record of the Ninth Annual ACM Symposium on Principles of Programming Languages, pp. 207–212. ACM Press, New York (1982)CrossRefGoogle Scholar
  3. 3.
    Emms, M., Leiß, H.: Extending the type checker of Standard ML by polymorphic recursion. Theoretical Computer Science 212(1–2), 157–181 (1999)Google Scholar
  4. 4.
    The Glasgow Haskell compiler, http://www.haskell.org/ghc/
  5. 5.
    Gill, A.: Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Glasgow University (1996)Google Scholar
  6. 6.
    Gill, A., Launchbury, J., Jones, S.L.P.: A Short Cut to Deforestation. In: FPCA 1993, Conference on Functional Programming Languages and Computer Architecture, pp. 223–232. ACM Press, New York (1993)CrossRefGoogle Scholar
  7. 7.
    Henglein, F.: Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems 15(2), 253–289 (1993)CrossRefGoogle Scholar
  8. 8.
    Hughes, J.: Why Functional Programming Matters. Computer Journal 32(2), 98–107 (1989)CrossRefGoogle Scholar
  9. 9.
    Kfoury, A.J., Tiuryn, J., Urzyczyn, P.: Type reconstruction in the presence of polymorphic recursion. ACM Transactions on Programming Languages and Systems 15(2), 290–311 (1993)CrossRefGoogle Scholar
  10. 10.
    Launchbury, J., Sheard, T.: Warm fusion: Deriving build-catas from recursive definitions. In: Conf. Record 7th ACM SIGPLAN/SIGARCH Intl. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1995, pp. 314–323. ACM Press, New York (1995)CrossRefGoogle Scholar
  11. 11.
    Lee, O., Yi, K.: Proofs about a folklore let-polymorphic type inference algorithm. ACM Transactions on Programming Languages and Systems 20(4), 707–723 (1998)CrossRefGoogle Scholar
  12. 12.
    Mycroft, A.: Polymorphic type schemes and recursive definitions. In: Paul, M., Robinet, B. (eds.) Programming 1984. LNCS, vol. 167, pp. 217–228. Springer, Heidelberg (1984)Google Scholar
  13. 13.
    Jones, S.L.P., Hughes, J., et al.: Haskell 98: A non-strict, purely functional language (February 1999), http://www.haskell.org
  14. 14.
    Jones, S.L.P., Launchbury, J.: Unboxed values as first class citizens in a non-strict functional language. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 636–666. Springer, Heidelberg (1991)Google Scholar
  15. 15.
    Jones, S.L.P., Marlow, S.: Secrets of the Glasgow Haskell compiler inliner. In: IDL 1999 (1999), http://www.binnetcorp.com/wshops/IDL99.html

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Olaf Chitil
    • 1
  1. 1.Lehrstuhl für Informatik IIRWTH AachenGermany

Personalised recommendations