## Generic programming within dependently typed programming (2003)

Venue: | In Generic Programming, 2003. Proceedings of the IFIP TC2 Working Conference on Generic Programming, Schloss Dagstuhl |

Citations: | 52 - 7 self |

### BibTeX

@INPROCEEDINGS{Altenkirch03genericprogramming,

author = {Thorsten Altenkirch and Conor Mcbride},

title = {Generic programming within dependently typed programming},

booktitle = {In Generic Programming, 2003. Proceedings of the IFIP TC2 Working Conference on Generic Programming, Schloss Dagstuhl},

year = {2003},

pages = {1--20},

publisher = {Kluwer Academic Publishers}

}

### Years of Citing Articles

### OpenURL

### Abstract

Abstract We show how higher kinded generic programming can be represented faithfully within a dependently typed programming system. This development has been implemented using the Oleg system. The present work can be seen as evidence for our thesis that extensions of type systems can be done by programming within a dependently typed language, using data as codes for types. 1.

### Citations

342 | Intuitionistic type theory - Martin-Löf - 1984 |

261 | Programming in Martin-Löf’s Type Theory: An Introduction - Nordstrom, Petersson, et al. - 1990 |

216 | Cayenne–a language with dependent types
- Augustsson
- 1998
(Show Context)
Citation Context ... 2 system [McB99], although essentially a proof checker, serves reluctantly as a rather spartan call-byvalue programming language. An alternative would have been to use the prototype Cayenne compiler =-=[Aug98]-=-, but Cayenne does not support inductively defined families as primitive, so this would have introduced an additional overhead. For the sake of readability, we take some notational liberties—overloadi... |

177 | Regular expression types for XML
- Hosoya, Vouillon, et al.
- 2000
(Show Context)
Citation Context ...comparable to that of Generic Haskell [CHJ + 01], but we could equally have chosen Tullsen’s calculus of polyadic functions [Tul00] or Pierce and Hosoya’s language of generic operations for valid XML =-=[HVP00]-=-. With dependently types, generic programming is just programming: it is not necessary to write a new compiler each time a useful universe presents itself. Moreover, any instance of a generic program ... |

174 | PolyP – a polytypic programming language extension - Jansson, Jeuring - 1997 |

141 | Views: a way for pattern matching to cohabit with data abstraction
- Wadler
- 1987
(Show Context)
Citation Context ...ulating the ‘external’ datatypes of which our universe makes copies—our programming language’s native N, Lam, Bush and so on. We need the means to treat the internal copy as a view, in Wadler’s sense =-=[Wad87]-=-, of the external structure. The same is true of Generic Haskell, where the isomorphisms between Haskell datatypes and their standardized sum-of-products presentations are constructed automatically.s2... |

121 | Derivable type classes - Hinze, Jones |

102 | 98: A non-strict, purely functional language. http://www.haskell.org - Jones, Hughes - 1999 |

85 | Pattern matching with dependent types
- Coquand
- 1992
(Show Context)
Citation Context ...e, we can omit the subscripted ∀s, because we show standard usage as well as enough information for types to be inferred. We define recursive functions by dependent pattern matching, as introduced in =-=[Coq92]-=-. For example, emb : ∀n:N. Fin n → Fin sn witnesses the fact that there is a value preserving embedding from Fin n to Fin sn. let x : Fin n emb x : Fin sn emb 0 ↦→ 0 emb (s x) ↦→ s (emb x) We can also... |

77 | Monadic presentations of lambda terms using generalized inductive types
- Altenkirch, Reus
- 1999
(Show Context)
Citation Context ...grams are defined is simply too large. Another advantage of the dependently typed version is that it can be easily generalized to a precise account of simply typed λ-terms over a given signature, see =-=[AR99]-=-. 1.4. Related Work Much of this work has been influenced by the Generic Haskell project [CHJ + 01]. In the current version Generic Haskell is implemented as a compiler front end—typechecking at this ... |

76 | Inductive sets and families in Martin-Löfs Type Theory and their set-theoretic semantics: An inversion principle for Martin-Löfs type theory
- Dybjer
- 1991
(Show Context)
Citation Context ...s. One such is Fin : N → Type of finite types indexed by their size: data n : N Fin n : Type where 0n : Fin sn i : Fin n sn i : Fin sn We say that Fin is an inductive family of datatypes indexed by N =-=[Dyb91]-=-. The sn constructor embeds Finn as the ‘old’ elements of Finsn, whilst 0 makes a ‘new’ element. Observe that both constructors target a restricted section of the family—the types with at least one el... |

70 | Dependently Typed Functional Programs and their Proofs
- McBride
- 1999
(Show Context)
Citation Context ...entation of generic equality and map (section 2.3). 1.2. Introducing Dependent Types We are using an implementation of Type Theory as a dependently typed programming language: McBride’s Oleg 2 system =-=[McB99]-=-, although essentially a proof checker, serves reluctantly as a rather spartan call-byvalue programming language. An alternative would have been to use the prototype Cayenne compiler [Aug98], but Caye... |

68 | R.: De Bruijn notation as a nested datatype - Bird, Paterson - 1999 |

38 | Henk: A typed intermediate language - Jones, Meijer - 1997 |

36 |
Proof Development System: User’s Manual
- LEGO
- 1992
(Show Context)
Citation Context ...e a lot of inferrable detail. The ‘flat’ types of the above identifiers, given in full, are Fin : N → Type 0 : ∀n:N. Fin sn s : ∀n:N. Fin n → Fin sn 2 Oleg is a rearrangement of Pollack’s Lego system =-=[LP92]-=-, with primitive support for programming.sGeneric Programming Within Dependently Typed Programming 5 Functions may have return types which depend on their argument values: → is just syntactic sugar fo... |

36 | The derivative of a regular type is its type of one-hole contexts. Unpublished manuscript (2001
- McBride
- 2012
(Show Context)
Citation Context ...ld have used positive, strictly positive or just finite types as introduced before. We include datatypes of higher kinds and nested datatypes, generalizing the construction for regular types given in =-=[McB01a]-=-. We present a generic recursion operator, fold, (section 2.3) which gives one way to define generic functions such as == or map for arbitrary kinds. In section 3 we present more details of our encodi... |

32 | The Generic Haskell user’s guide - Clarke, Hinze, et al. - 2001 |

32 | Generic Programs and Proofs
- Hinze
- 2000
(Show Context)
Citation Context ...higher kinds, it is a parametric operation, transforming an equality at the sourcesGeneric Programming Within Dependently Typed Programming 3 kind to an equality at the target kind. As Hinze observed =-=[Hin00]-=-, this parametrization is systematic—we need only implement == itself by recursion over ground types 1 : (==) {| t :: k |} :: Eq {[ k ]} t (==) {| Unit |} _ _ = True (==) {| :+: |} eqA eqB (Inl a1) (I... |

29 |
From fast exponentiation to square matrices: an adventure in types
- Okasaki
- 1999
(Show Context)
Citation Context ... over much smaller sets than ⋆, and are hence more precisely structured. Whilst it has been shown that invariants such as squareness of matrices and balancing of trees can be enforced by nested types =-=[Oka99]-=-, it takes an impressive degree of ingenuity to deliver what are basically trivial instances of dependent types. We have yet to see which universes capture the classes of dependent datatypes over whic... |

27 | Faking It (Simulating Dependent Types in Haskell
- McBride
- 2002
(Show Context)
Citation Context ...e type constructor as the operation to construct a constant vector: let a : A n : N a n : A n a n x ↦→ a We can lift application to vectors, as McBride does in his Haskell definition of n-ary zipWith =-=[McB01b]-=-: let f : (A → B) n a : A n f a : B n f a x ↦→ (f x) (a x) These two definitions allow us to map a function f across a vector a just by writing f n a. In fact, this reduces to the composition f ◦ a.s6... |

24 | Manufacturing datatypes - Hinze - 2001 |

8 | Generic programming—an introduction - Backhouse, Jansson, et al. - 1999 |

7 | The Zip Calculus
- Tullsen
- 2000
(Show Context)
Citation Context ...We chose the concrete datatypes of Haskell as our example, delivering power comparable to that of Generic Haskell [CHJ + 01], but we could equally have chosen Tullsen’s calculus of polyadic functions =-=[Tul00]-=- or Pierce and Hosoya’s language of generic operations for valid XML [HVP00]. With dependently types, generic programming is just programming: it is not necessary to write a new compiler each time a u... |

2 | Polytipic Abstraction in Type Theory
- Pfeifer, Ruess
- 1998
(Show Context)
Citation Context ...Haskell project [CHJ + 01]. In the current version Generic Haskell is implemented as a compiler front end—typechecking at this level is not yet realized. The topic of this paper is clearly related to =-=[PR98]-=-, where the authors also use Type Theory to represent polytypic programs. However, they do not actually introduce a universe but simply a library of operators which work on functors and bifunctors of ... |

2 | Pure type systems for functional programming - Roorda - 2000 |

1 |
Oleg code for Generic Programming Within Dependently Typed Programming. Available from http://www.dur.ac.uk/c.t.mcbride/generic
- Altenkirch, McBride
- 2002
(Show Context)
Citation Context ...erties—overloading, infix and postfix operations, superscripting and subscripting—but the full Oleg script, together with a document explaining its correspondence with this paper, is available online =-=[AM02]-=-. In a dependently typed programming language, we may define families of types which depend on values. One such is Fin : N → Type of finite types indexed by their size: data n : N Fin n : Type where 0... |

1 |
Towards generic programming in Type Theory. Talk at the workshop TYPES 2002, Berg en Dal
- Benke
- 2002
(Show Context)
Citation Context ...d present a combinator to derive many polytypic programs. Our domain is also more general in that we allow higher order kinds and mutual inductive definitions with several parameters. Recently, Benke =-=[Ben02]-=- presented preliminary results on an implementation of generic programming in AGDA, a dependently typed systems8 developed at Chalmers University, Göteborg. His goal is to codify generic operations on... |

1 |
The view from the left. Submitted to the
- McBride, McKinna
- 2001
(Show Context)
Citation Context ...ions are constructed automatically.s20 Dependent types may make this construction easier, for as McBride and McKinna have shown, views are already first class citizens of a dependently typed language =-=[MM01]-=-—dependency on terms allows admissible notions of pattern matching to be specified by types. We plan to integrate this technology with universe constructions, defining generic programs abstractly over... |