Skip to main content

Polytypic Programming With Ease

(Extended Abstract)

  • Conference paper

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

Abstract

This paper proposes a new framework for a polytypic extension of functional programming languages. A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values, they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not necessarily more complicated than conventional programming. In fact, a polytypic function is uniquely defined by its action on constant functors, projection functors, sums, and products. This information is sufficient to specialize a polytypic function to arbitrary datatypes, including mutually recursive datatypes and nested datatypes. The key idea is to use infinite trees as index sets for polytypic functions and to interpret datatypes as algebraic trees. This approach is simpler, more general, and more efficient than previous ones that are based on the initial algebra semantics of datatypes.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Cardelli, L., Pierce, B., Rémy, D.: Dynamic typing in polymorphic languages. J. Functional Programming 5(1), 111–130 (1995)

    Article  MATH  Google Scholar 

  2. Bird, R.: Introduction to Functional Programming using Haskell, 2nd edn. Prentice Hall Europe, London (1998)

    Google Scholar 

  3. Bird, R., de Moor, O., Hoogendijk, P.: Generic functional programming with types and relations. J. Functional Programming 6(1), 1–28 (1996)

    Article  MATH  Google Scholar 

  4. Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  5. Courcelle, B.: Fundamental properties of infinite trees. Theoretical Computer Science 25(2), 95–169 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  6. Hinze, R.: Generalizing generalized tries. J. Functional Programming (1999) (accepted for publication)

    Google Scholar 

  7. Hinze, R.: Polytypic functions over nested datatypes. Discrete Mathematics and Theoretical Computer Science (1999) (accepted for publication)

    Google Scholar 

  8. Hinze, R.: Polytypic programming with ease. Technical Report IAI-TR-99-2, Institut fúr Informatik III, Universität Bonn (February 1999)

    Google Scholar 

  9. Jansson, P., Jeuring, J.: Polytypic compact printing and parsing. In: Swierstra, S.D. (ed.) ESOP 1999. LNCS, vol. 1576, pp. 273–287. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  10. Jansson, P., Jeuring, J.: PolyP–a polytypic programming language extension. In: 24th Symposium on Principles of Programming Languages, POPL 1997, pp. 470–482. ACM-Press, New York (1997)

    Chapter  Google Scholar 

  11. Jansson, P., Jeuring, J.: Functional Pearl: Polytypic unification. J. Functional Programming 8(5), 527–536 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  12. Jansson, P., Jeuring, J.: PolyLib–A library of polytypic functions. In: Backhouse, R., Sheard, T. (eds.) Informal Proceedings Workshop on Generic Programming, WGP 1998. Department of Computing Science, Chalmers University of Technology and Göteborg University (June 1998), http://wsinwp01.win.tue.nl:1234/WGPProceedings/index.html

  13. Jones, M.P.: Functional programming with overloading and higher-order polymorphism. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 97–136. Springer, Heidelberg (1995)

    Google Scholar 

  14. Jones, M.P., Peterson, J.C.: Hugs 98 User Manual (May 1999), Available from http://www.haskell.org/hugs

  15. McCracken, N.J.: The typechecking of programs with implicit type structure. In: Plotkin, G., MacQueen, D.B., Kahn, G. (eds.) Semantics of Data Types 1984. LNCS, vol. 173, pp. 301–315. Springer, Heidelberg (1984)

    Google Scholar 

  16. Meertens, L.: Calculate polytypically! In: Kuchen, H., Swierstra, S.D. (eds.) PLILP 1996. LNCS, vol. 1140, pp. 1–16. Springer, Heidelberg (1996)

    Google Scholar 

  17. Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)

    Google Scholar 

  18. Meijer, E., Hutton, G.: Bananas in space: Extending fold and unfold to exponential types. In: 7th Conference on Functional Programming Languages and Computer Architecture, FPCA 1995, pp. 324–333. ACM-Press, New York (1995)

    Chapter  Google Scholar 

  19. Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)

    Book  Google Scholar 

  20. Jones, S.P.: Explicit quantification in Haskell (1998), Available from http://research.microsoft.com/Users/simonpj/Haskell/quantification.html

  21. Jones, S.P., Hughes, J. (eds.): Haskell 98 – A Non-strict, Purely Functional Language (February 1999), http://www.haskell.org/onlinereport/

  22. Yang, Z.: Encoding types in ML-like languages. SIGPLAN Notices 34(1), 289–300 (1999)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hinze, R. (1999). Polytypic Programming With Ease. In: Middeldorp, A., Sato, T. (eds) Functional and Logic Programming. FLOPS 1999. Lecture Notes in Computer Science, vol 1722. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10705424_2

Download citation

  • DOI: https://doi.org/10.1007/10705424_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-66677-6

  • Online ISBN: 978-3-540-47950-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics