skip to main content
10.1145/263699.263763acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free Access

PolyP—a polytypic programming language extension

Authors Info & Claims
Published:01 January 1997Publication History

ABSTRACT

Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on different datatypes. Examples of such functions are pretty printers, debuggers, equality functions, unifiers, pattern matchers, rewriting functions, etc. Such functions are called polytypic functions. A polytypic function is a function that is defined by induction on the structure of user-defined datatypes. This paper extends a functional language (a subset of Haskell) with a construct for writing polytypic functions. The extended language type checks definitions of polytypic functions, and infers the types of all other expressions using an extension of Jones' theories of qualified types and higher-order polymorphism. The semantics of the programs in the extended language is obtained by adding type arguments to functions in a dictionary passing style. Programs in the extended language are translated to Haskell.

References

  1. 1.Timothy C. Bell, John G. Cleary, and lanH. Witten. Text Compression. PrenticeHail, 1990, Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2.G. Bell#, C.B. Jay, and E. Moggi. Functorial ML. In PLILP '96. Springer-Verlag, 1996. LNCS Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3.C. BShm and A. Berarducci. Automatic synthesis of type :A-programs on term algebras. Theoretical Compeer Science, 39:135-154,1 1985,Google ScholarGoogle ScholarCross RefCross Ref
  4. 4.Robert D. Cameron. Source encoding using syntactic information source models. IEEE Transactions on Information Theory, 34(4):843-850, 1988.Google ScholarGoogle ScholarCross RefCross Ref
  5. 5.J.F. Contla. Compact coding of synt#tically correct source programs. Software-Practice and Experience, 15(7) :625,636, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6.L. Damas and R. Milner. Principal type,schemes for functional programs. In gth Symposium on Priciples of Prograraming Languages, POPL '82, pages 207-212, 1982.# .. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7.N. Dershowitz. A note on simplification orderings. Information Processing Letters, 9(5):212-215, 1979.Google ScholarGoogle ScholarCross RefCross Ref
  8. 8.J.H. Fasel, P, Hudak, S Peyton Jones, and P. Wadler. Sigplan Notices special issue on the Functional Programming Language H#kell. A CM SIGPLAN notices, 27(5), 1992.Google ScholarGoogle Scholar
  9. 9.P. Freyd. Recursive types reduced to inductive types. In Proceedings Logic in Computer Science, LICS '90, pages 498-507, 1990.Google ScholarGoogle ScholarCross RefCross Ref
  10. 10.Robert Harper and Greg Morrisett. Compiling polymorphism using intensional type analysis. In#2#ndSymposium on Priciples of Programming Languages, POPL '95, pages 130-141, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 11.P. Jansson. Polytypism and polytypic unification. Master's thesis, Chalmers University of Technology and University of GSteborg,# 1995.Google ScholarGoogle Scholar
  12. 12.P. Jansson and J. Jeuring. Polytypic unification -- implementing polytypic functions with constructor classes. In preparation, see http://www, cs. chalmers se/'johanj, 1996.Google ScholarGoogle Scholar
  13. 13.C. Barry Jay. Polynomial polymorphism. In Proceedings of the Eighteenth Australasian Computer Science Conference, pages 237-243, 1995.Google ScholarGoogle Scholar
  14. 14.C. Barry Jay, A semantics for shape. Science of Computer Programming, 25:251-283, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15.J. Jeuring. Polytypic pattern matching. In Conference Record of FPCA '95, 8IGPLAN-SIGARGH- WG2.8 Conference on Functional Programming Languages and Computer Architecture, pages 238- 248, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16.J. Jeuring and P. Jansson. Polytypic programming. In J. Launchbury, E. Meijer, and T. Sheard, editors, Proceedings of the Second International Summer School on Advanced Functional Programming Techniques, pages 68-114. Springer-Verlag, 1996. LNCS 1129. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17.Mark P. Jones. Dictionary-free overloading by partial evaluation, in A CM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Orlando, Florida, June 1994.Google ScholarGoogle Scholar
  18. 18.Mark P. Jones. Qualified Types: Theory and!Practice. Cambridge University Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19.Mark P. Jones. Functional programming with overloading and higher-order p01ymorphism. In J. Jeuring and E. Meijer, editors, Advan#d Functional Programming, LNCS 925, pages 97-136. Springer- Verlag, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 20.Mark P. Jones. A system of constructor closes: overloading and implicit higher-order polymorphism. Journal of Functional Programming, pages 1-35, 1995.Google ScholarGoogle Scholar
  21. 21.J.W. Klop. Term rewriting systems. In Handbook of Logic in Computer Science, pages 1-116. Oxford University Press, 1992. # Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22.D.E. Knuth and P.B.# Bendix. Simple word problems in universal algebras. In J. Leech, editor, Computational Problems in Abstract Algebra, pages 263-29?. Pergamon Press, 1970.Google ScholarGoogle Scholar
  23. 23.K.J. Lieberherr, I. Silva-Lepe, and C. Xiao. Adaptive object-oriented programming -- using graphbased customization. Communications of the A CM, pages 94-101, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 24.G. Malcolm. Data structures and program transformation. Science of Computer Programming, 14:255-279, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25.A. MarteUi, C. Moiso, and C.F. Rossi. An algorithm for unification in equational theories. In Proc. Symposium on Logic Programming, pages 180-186, 1986.Google ScholarGoogle Scholar
  26. 26.L. Meertens. Param0rphisms. Formal Aspects of Computing, 4(5):413-425, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  27. 27.E. Meijer, M. Fokkinga, and R. Paterson. Fhnctional programming with b#manas, lenses, ei#- velopes, and barbed .wire. In J, Hughes, editor, Proceedings of the 5th A CM Conference on #Func. tional Programming Languages and Computer Architecture, FPCA '91, pages 124-144, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28.E. Meijer and G. Hutton. Bananas in space" Extending fold and unfold to exponenti~ types. In Conference Record of FPCA '95, SIGPLAN- SIGARCH- WG#.8 Conference on Functional Programming Languages and Computer Architecture, pages 324-333, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 29.j. Palsberg, C. Xiao, and K. Lieberherr. Efficient implementation of adaptive software. TOPLAS, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 30.T. Sheard and':N: Nelson' Type safe abstractions using program generat0rs.# Unpublished manuscript, 1995. # #Google ScholarGoogle Scholar
  31. 31.Tim Sheard. Automatic generation anduse of abstract structure operators. A GM Transactions on Programming Languages and Systems, 13 (4):531- 557, 1991. .. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. 32.J. Ziv and A, Lempel. A universal algorithm for sequential datacompressi0n, iEEE Transactions on# Information Theory, 23(3):337-343, 1977.Google ScholarGoogle Scholar

Index Terms

  1. PolyP—a polytypic programming language extension

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in
                • Published in

                  cover image ACM Conferences
                  POPL '97: Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
                  January 1997
                  497 pages
                  ISBN:0897918533
                  DOI:10.1145/263699

                  Copyright © 1997 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 January 1997

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • Article

                  Acceptance Rates

                  POPL '97 Paper Acceptance Rate36of225submissions,16%Overall Acceptance Rate824of4,130submissions,20%

                  Upcoming Conference

                  POPL '25

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader