Functional Polytypic Programming --- Use and Implementation

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, pattern matchers, equality functions, unifiers, 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 thesis introduces polytypic functions, shows how to construct and reason about polytypic functions and describes the implementation of the polytypic programming system PolyP. PolyP 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. Programs in the extended language are translated to Haskell.

[1]  Roland Carl Backhouse An Exploration of the Bird-Meertens Formalism , 1989 .

[2]  D. Knuth,et al.  Simple Word Problems in Universal Algebras , 1983 .

[3]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[4]  Robert D. Cameron Source encoding using syntactic information source models , 1988, IEEE Trans. Inf. Theory.

[5]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[6]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[7]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[8]  Mans Vestin Genetic algorithms in Haskell with polytypic programming , 1997 .

[9]  G. Malcolm,et al.  Data Structures and Program Transformation , 1990, Sci. Comput. Program..

[10]  Programming Languages: Implementations, Logics and Programs , 1995, Lecture Notes in Computer Science.

[11]  Jeroen D. Fokker,et al.  Functional Parsers , 1995, Advanced Functional Programming.

[12]  Mark P. Jones A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[13]  Niklas Röjemo,et al.  Highlights from nhc—a space-efficient Haskell compiler , 1995, FPCA '95.

[14]  Graham Hutton,et al.  Bananas in space: extending fold and unfold to exponential types , 1995, FPCA '95.

[15]  Maarten M. Fokkinga,et al.  Law and order in algorithmics , 1992 .

[16]  Maarten M. Fokkinga,et al.  Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire , 1991, FPCA.

[17]  Simon L. Peyton Jones,et al.  SIGPLAN Notices Special Issue on the Functional Programming Language Haskell , 1992, ACM SIGPLAN Notices.

[18]  Ian H. Witten,et al.  Compressing computer programs , 1993 .

[19]  Akihiko Takano,et al.  Tupling calculation eliminates multiple data traversals , 1997, ICFP '97.

[20]  Peter J. Freyd,et al.  Recursive types reduced to inductive types , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[21]  Oege de Moor A Generic Program for Sequential Decision Processes , 1995, PLILP.

[22]  Johan Jeuring,et al.  Polytypic Programming , 1996, Advanced Functional Programming.

[23]  Karl J. Lieberherr,et al.  Adaptive object-oriented programming using graph-based customization , 1994, CACM.

[24]  Maarten M. Fokkinga Monadic Maps and Folds for Arbitrary Datatypes , 1994 .

[25]  Mark P. Jones,et al.  Functional Programming with Overloading and Higher-Order Polymorphism , 1995, Advanced Functional Programming.

[26]  Tim Sheard,et al.  Revisiting catamorphisms over datatypes with embedded functions , 1995 .

[27]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[28]  Johan Jeuring,et al.  Merging Monads and Folds for Functional Programming , 1995, Advanced Functional Programming.

[29]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[30]  Patrik Jansson Polytypism and polytypic unification , 1995 .

[31]  Lambert Meertens,et al.  Algorithmics : towards programming as a mathematical activity , 1986 .

[32]  Michael A. Arbib,et al.  Algebraic Approaches to Program Semantics , 1986, Texts and Monographs in Computer Science.

[33]  Johan Jeuring Algorithms for Theorems , 1990, Programming Concepts and Methods.

[34]  Richard S. Bird,et al.  An introduction to the theory of lists , 1987 .

[35]  Marieke Huisman The Calculation of a Polytypic Parser , 1996 .

[36]  Tim Sheard,et al.  Type safe abstractions using program generators , 1995 .

[37]  Tim Sheard,et al.  A fold for all seasons , 1993, FPCA '93.

[38]  Philip Wadler,et al.  Deforestation: Transforming Programs to Eliminate Trees , 1990, Theor. Comput. Sci..

[39]  C. Barry Jay,et al.  A Semantics for Shape , 1995, Sci. Comput. Program..

[40]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[41]  Tim Sheard,et al.  Automatic generation and use of abstract structure operators , 1991, TOPL.

[42]  Richard S. Bird,et al.  Lectures on Constructive Functional Programming , 1989 .

[43]  Roland Carl Backhouse,et al.  When Do Datatypes Commute? , 1997, Category Theory and Computer Science.

[44]  Akihiko Takano,et al.  Shortcut deforestation in calculational form , 1995, FPCA '95.

[45]  Mark P. Jones Dictionary-free overloading by partial evaluation , 1995, LISP Symb. Comput..

[46]  James Hook,et al.  A Semantics of Compile-time Reflection , 1993 .

[47]  R. G. Stone On the Choice of Grammar and Parser for the Compact Analytical Encoding of Programs , 1986, Comput. J..

[48]  Martti Penttonen,et al.  Syntax‐directed compression of program files , 1986, Softw. Pract. Exp..

[49]  C. Xiao Eecient Implementation of Adaptive Software , 1994 .

[50]  Johan Jeuring,et al.  PolyP—a polytypic programming language extension , 1997, POPL '97.

[51]  Maarten M. Fokkinga Datatype Laws without Signatures , 1996, Math. Struct. Comput. Sci..

[52]  Richard S. Bird,et al.  Generic functional programming with types and relations , 1996, Journal of Functional Programming.

[53]  Oege de Moor,et al.  Categories, relations and dynamic programming , 1994, Mathematical Structures in Computer Science.

[54]  Leonidas Fegaras Fusion for Free , 1996 .

[55]  Karl Fritz Ruehr,et al.  Analytical and structural polymorphism expressed using patterns over types , 1992 .

[56]  Johan Jeuring Polytypic pattern matching , 1995, FPCA '95.

[57]  Abraham Lempel,et al.  A universal algorithm for sequential data compression , 1977, IEEE Trans. Inf. Theory.

[58]  Grant Malcolm Homomorphisms and Promotability , 1989, MPC.

[59]  Jose Felipe Contla Compact coding of syntactically correct source programs , 1985, Softw. Pract. Exp..

[60]  Tim Sheard,et al.  Type parametric programming , 1993 .

[61]  John Hughes,et al.  The Design of a Pretty-printing Library , 1995, Advanced Functional Programming.

[62]  Terry A. Welch,et al.  A Technique for High-Performance Data Compression , 1984, Computer.