Arity-generic datatype-generic programming

Some programs are doubly-generic. For example, map is datatype-generic in that many different data structures support a mapping operation. A generic programming language like Generic Haskell can use a single definition to generate map for each type. However, map is also arity-generic because it belongs to a family of related operations that differ in the number of arguments. For lists, this family includes repeat, map, zipWith, zipWith3, zipWith4, etc. With dependent types or clever programming, one can unify all of these functions together in a single definition. However, no one has explored the combination of these two forms of genericity. These two axes are not orthogonal because the idea of arity appears in Generic Haskell: datatype-generic versions of repeat, map and zipWith have different arities of kind-indexed types. In this paper, we define arity-generic datatype-generic programs by building a framework for Generic Haskell-style generic programming in the dependently-typed programming language Agda 2.

[1]  Conor McBride Faking it: Simulating dependent types in Haskell , 2002, J. Funct. Program..

[2]  Tim Sheard,et al.  Generic Programming in Ωmega , 2006, SSDGP.

[3]  U. Norell,et al.  Towards a practical programming language based on dependent type theory , 2007 .

[4]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

[5]  Adam Chlipala,et al.  A certified type-preserving compiler from lambda calculus to assembly language , 2007, PLDI '07.

[6]  Hugo Herbelin,et al.  The Coq proof assistant : reference manual, version 6.1 , 1997 .

[7]  Conor McBride,et al.  The view from the left , 2004, Journal of Functional Programming.

[8]  Ralf Hinze,et al.  Generic Haskell: Practice and Theory , 2003, Generic Programming.

[9]  Peter Dybjer,et al.  Universes for Generic Programs and Proofs in Dependent Type Theory , 2003, Nord. J. Comput..

[10]  Robert Harper,et al.  Type Checking with Universes , 1991, Theor. Comput. Sci..

[11]  Daniel Fridlender,et al.  Do we Need Dependent Types , 2001 .

[12]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[13]  Ralf Hinze,et al.  The Generic Haskell user's guide , 2001 .

[14]  Sam Tobin-Hochstadt,et al.  Practical Variable-Arity Polymorphism , 2009, ESOP.

[15]  Tim Sheard,et al.  Putting curry-howard to work , 2005, Haskell '05.

[16]  Stephanie Weirich RepLib: a library for derivable type classes , 2006, Haskell '06.

[17]  Simon L. Peyton Jones,et al.  Associated type synonyms , 2005, ICFP '05.

[18]  Stephanie Weirich,et al.  Type-safe run-time polytypic programming , 2006, Journal of Functional Programming.

[19]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[20]  Ralf Hinze Generics for the masses , 2006, J. Funct. Program..

[21]  Edsko de Vries,et al.  Polytypic programming in COQ , 2008, WGP '08.

[22]  Ralf Hinze,et al.  Polytypic values possess polykinded types , 2000, Sci. Comput. Program..

[23]  Per Martin-Löf,et al.  Intuitionistic type theory , 1984, Studies in proof theory.

[24]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[25]  Peter Morris,et al.  Constructing Strictly Positive Families , 2007, CATS.

[26]  Thorsten Altenkirch,et al.  Generic Programming within Dependently Typed Programming , 2002, Generic Programming.

[27]  Edsko de Vries,et al.  Polytypic properties and proofs in Coq , 2009, WGP '09.

[28]  E. Van Gestel,et al.  Programming in Martin-Löf's Type Theory: an Introduction : Bengt Nordström, Kent Petersson and Jan M. Smith Intl. Series of Monographs on Computer Science, Vol. 7, Oxford Science Publications, Oxford, 1990, 231 pages , 1991 .

[29]  Bruno C. d. S. Oliveira,et al.  Extensible and modular generics for the masses , 2006, Trends in Functional Programming.