Skip to main content

Projections for polymorphic strictness analysis

  • Conference paper
  • First Online:
Category Theory and Computer Science

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 389))

Abstract

We apply the categorical properties of polymorphic functions to compile-time analysis, specifically projection-based strictness analysis. First we interpret parameterised types as functors in a suitable category, and show that they preserve monics and epics. Then we define “strong” and “weak” polymorphism — the latter admitting certain projections that are not polymorphic in the usual sense. We prove that, under the right conditions, a weakly polymorphic function is characterised by a single instance. It follows that the strictness analysis of one simple instance of a polymorphic function yields results that apply to all. We show how this theory may be applied.

In comparison to earlier polymorphic strictness analysis methods, ours can apply polymorphic information to a particular instance very simply. The categorical approach simplifies our proofs, enabling them to be carried out at a higher level, and making them independent of the precise form of the programming language to be analysed.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. S. Abramsky, Strictness Analysis and Polymorphic Invariance, Workshop on Programs as Data Objects, Copenhagen, Springer LNCS 217, 1985.

    Google Scholar 

  2. S. Abramsky, Notes on Strictness Analysis for Polymorphic Functions, draft paper, 1988.

    Google Scholar 

  3. S. Abramsky and C. L. Hankin (eds.) Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.

    Google Scholar 

  4. G. L. Burn, C. L. Hankin, S. Abramsky, The Theory of Strictness Analysis for Higher-order Functions, Workshop on Programs as Data Objects, Copenhagen, Springer LNCS 217, 1985.

    Google Scholar 

  5. C. Clack and S. L. Peyton-Jones, Strictness Analysis — a Practical Approach, in IFIP Conference on Functional Programming Languages and Computer Architecture, Nancy, France, Springer LNCS 201, 1985.

    Google Scholar 

  6. P. Dybjer, Computing Inverse Images, in ICALP 1987.

    Google Scholar 

  7. B. Goldberg, Detecting Sharing of Partial Applications in Functional Programs, in IFIP Conference on Functional Programming Languages and Computer Architecture, Portland, Oregon, Springer LNCS 274, 1987.

    Google Scholar 

  8. C. Hall and D. S. Wise, Compiling Strictness into Streams, in ACM Symposium on Principles of Programming Languages, 1987.

    Google Scholar 

  9. P. Hudak and J. Young, Higher-order Strictness Analysis for Untyped Lambda Calculus, in ACM Symposium on Principles of Programming Languages, 1986.

    Google Scholar 

  10. P. Hudak, Abstract reference counting, in S. Abramsky and C. L. Hankin (eds.) Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.

    Google Scholar 

  11. J. Hughes, Strictness Detection in Non-Flat Domains, Workshop on Programs as Data Objects, Copenhagen, Springer Verlag 217, 1985.

    Google Scholar 

  12. J. Hughes, Analysing Strictness by Abstract Interpretation of Continuations, in S. Abramsky and C. L. Hankin (eds.) Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.

    Google Scholar 

  13. J. Hughes, Backwards Analysis of Functional Programs, IFIP Workshop on Partial Evaluation and Mixed Computation, Bjørner, Ershov and Jones (eds.), North-Holland, 1987.

    Google Scholar 

  14. J. Hughes, Abstract Interpretation of First-order Polymorphic Functions, Proc. Aspenæs Workshop on Graph Reduction, University of Gothenburg, 1988.

    Google Scholar 

  15. J. Hughes, Compile-time Analysis of Functional Languages, Proc. Year of Programming Summer School on Declarative Programming, University of Texas, 1989 (to appear).

    Google Scholar 

  16. J. Launchbury, Projections for Specialisation, IFIP Workshop on Partial Evaluation and Mixed Computation, Bjørner, Ershov and Jones (eds.), North-Holland, 1987.

    Google Scholar 

  17. J. Launchbury, Binding Time Aspects of Partial Evaluation, Ph.D. thesis, Glasgow University, in preparation.

    Google Scholar 

  18. C. Martin and C. Hankin, Finding Fixed Points in Finite Lattices, IFIP Conference on Functional Programming Languages and Computer Architecture, Portland, Oregon, Springer LNCS 274, 1987.

    Google Scholar 

  19. A. Mycroft, The Theory and Practice of Transforming Call-by-Need into Call-by-Value, Proc. International Symposium on Programming, Springer LNCS 83, 1980.

    Google Scholar 

  20. Tutorial on natural transformations, in Proc. Category Theory and Computer Programming, Springer LNCS 240, 1985.

    Google Scholar 

  21. M. Sheeran, Categories for the Working Hardware Designer, to appear in Proc. Int. Workshop on Hardware Specification, Verification, and Synthesis: Mathematical Aspects, Cornell, Springer LNCS, 1989.

    Google Scholar 

  22. P. Wadler and J. Hughes, Projections for Strictness Analysis, IFIP Conference on Functional Programming Languages and Computer Architecture, Portland, Oregon, Springer LNCS 274, 1987.

    Google Scholar 

  23. P. Wadler, Strictness Analysis on Non-flat Domains (by Abstract Interpretation over Finite Domains), in S. Abramsky and C. L. Hankin (eds.) Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.

    Google Scholar 

  24. P. Wadler, Strictness Analysis Aids Time Analysis, in ACM Symposium on Principles of Programming Languages, 1988.

    Google Scholar 

  25. P. Wadler, Theorems for Free!, to appear in IFIP Functional Programming Languages and Computer Architecture, London, Springer LNCS, 1989.

    Google Scholar 

  26. S. C. Wray, Implementation and Programming Techniques for Functional Languages, Ph.D. thesis, University of Cambridge, 1986.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

David H. Pitt David E. Rydeheard Peter Dybjer Andrew M. Pitts Axel Poigné

Rights and permissions

Reprints and permissions

Copyright information

© 1989 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hughes, J. (1989). Projections for polymorphic strictness analysis. In: Pitt, D.H., Rydeheard, D.E., Dybjer, P., Pitts, A.M., Poigné, A. (eds) Category Theory and Computer Science. Lecture Notes in Computer Science, vol 389. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0018346

Download citation

  • DOI: https://doi.org/10.1007/BFb0018346

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-51662-0

  • Online ISBN: 978-3-540-46740-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics