## A New Approach to Generic Functional Programming (1999)

### Cached

### Download Links

- [www.informatik.uni-bonn.de]
- [www.informatik.uni-bonn.de]
- [www.informatik.uni-bonn.de]
- DBLP

### Other Repositories/Bibliography

Venue: | In The 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages |

Citations: | 95 - 13 self |

### BibTeX

@INPROCEEDINGS{Hinze99anew,

author = {Ralf Hinze},

title = {A New Approach to Generic Functional Programming},

booktitle = {In The 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},

year = {1999},

pages = {119--132},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

This paper describes a new approach to generic functional programming, which allows us to define functions generically for all datatypes expressible in Haskell. A generic function is one that is defined by induction on the structure of types. Typical examples include pretty printers, parsers, and comparison functions. The advanced type system of Haskell presents a real challenge: datatypes may be parameterized not only by types but also by type constructors, type definitions may involve mutual recursion, and recursive calls of type constructors can be arbitrarily nested. We show that--- despite this complexity---a generic function is uniquely defined by giving cases for primitive types and type constructors (such as disjoint unions and cartesian products). Given this information a generic function can be specialized to arbitrary Haskell datatypes. The key idea of the approach is to model types by terms of the simply typed -calculus augmented by a family of recursion operators. While co...

### Citations

1119 |
The Lambda Calculus: Its Syntax and Semantics
- BARENDREGT
- 1984
(Show Context)
Citation Context ...defined as follows: if t has hnf x 1 : : : xm ! z u1 : : : un , then BT(t) = x 1 : : : xm ! z BT(u 1 ) \Delta \Delta \Delta BT(u n ) : For a more formal treatment of Bohm trees we refer the reader to =-=[2]-=-. Now, from a generic programming point of view we can identify type terms that have the same Bohm trees, i.e., t = u if BT(t) = BT(u). We have, for instance, Rose = GRose (a ! Fix (BaseList a)). Sinc... |

519 | Lambda calculi with types
- Barendregt
- 1992
(Show Context)
Citation Context ...itable candidates are the intermediate language of the Glasgow Haskell Compiler [38], which is based on the secondorders-calculus [11], or the language Henk [39], which is based on Barendregt's -cube =-=[3]-=-. 9 sizeList :: 8a:(8x :a x ! Int) ! (8x :List (a x) ! Int) sizeList sizea = sizel where sizel Nil = 0 sizel (Cons x xs) = sizea x + sizel xs sizeRose :: 8a:(8x :a x ! Int) ! (8x :Rose (a x) ! Int) si... |

285 | Interpre'tation fonctionelle et e'limination des coupures duns l'arithme'tique d'ordre supe'rieure - Girard - 1972 |

216 | Cayenne - a language with dependent types - Augustsson - 1998 |

215 | Introduction to Functional Programming using Haskell, 2nd edition - Bird - 1998 |

201 | The Lambda Calculus: its Syntax and Semantics”, revised edition - Barendregt - 1984 |

179 | A system of constructor classes: overloading and implicit higher-order polymorphism - Jones - 1993 |

97 | Dynamic Typing in Polymorphic Languages
- Abadi, Cardelli, et al.
- 1992
(Show Context)
Citation Context ...this problem by using encodings into a universal datatype [45] or by using dynamic types and a 1 The definition of enc exhibits \Theta(n 2 ) worst-case behaviour, but this is easy to remedy. typecase =-=[1]-=-, the result would be rather inefficient because enc would repeatedly interpret its type argument. By specializingsenchti for a given t we remove this interpretative layer. As an aside, one could argu... |

69 | Functional Programming with Overloading and Higher-Order Polymorphism - Jones - 1995 |

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

40 | A generic programming extension for Haskell - Hinze - 1999 |

32 | Category theoretic approach to data types - Hagino - 1987 |

24 | Fundamental properties of infinite trees, Theoretical Computer Science 25 - Courcelle - 1983 |

24 | Manufacturing datatypes - Hinze - 2001 |

23 |
Introduction to Functional Programming using
- Bird
- 1998
(Show Context)
Citation Context ...nstrate the expressiveness of Haskell's type system and to give evidence that real use has been made of these features. As first, rather simple examples consider the datatypes of lists and rose trees =-=[4]-=-. data List a = Nil j Cons a (List a) data Rose a = Branch a (List (Rose a)) The two equations introduce two type constructors, List and Rose , of kind ? ! ?. The kind system of Haskell specifies the ... |

13 | Polytypic functions over nested datatypes - Hinze - 1999 |

13 | Polytypic programming with ease - HINZE - 1999 |

12 | Polytypic programming. Pages 68--114 of - Jeuring - 1996 |

10 | Generalised folds for nested datatypes. Formal Aspects of Computing 11(2 - Bird, Paterson - 1999 |

9 | Nested datatypes. Pages 52–67 of - Bird, Meertens - 1998 |

9 | PolyLib—A library of polytypic functions - Jansson, Jeuring - 1998 |

8 | About Charity, Yellow Series Report 92/480/18 - Cockett, Fukushima - 1992 |

7 | international conference on mathematics of program construction - Fourth |

5 | Numerical Representations as Higher-Order Nested Datatypes - Hinze - 1998 |

5 | A technical summary of the new features - Jones - 1998 |

3 | Type classes in Haskell. ACM transactions on programming languages and systems - Hall, Hammond, et al. - 1996 |

1 | Lambda calculi with types. Pages 118--309 of: Abramsky - Barendregt - 1992 |

1 | Generalizing generalized tries. Journal of functional programming. Accepted for publication - Hinze - 1999 |

1 | PolyP---a polytypic programming language 24 R. Hinze extension - Jansson - 1997 |

1 | Shapely types and shape polymorphism. Pages 302-- 316 of: Sanella, D. (ed), Programming languages and systems --- ESOP'94: 5th european symposium on programming - Jay - 1994 |