# Discrete Mathematics & Theoretical Computer Science

## Volume 3 n° 4 (1999), pp. 193-214

author: | Ralf Hinze |
---|---|

title: | Polytypic Functions Over Nested Datatypes |

keywords: | Functional programming, generic programming, nested datatypes, rational trees, reductions. |

abstract: | The theory and practice of polytypic programming is intimately connected with the initial algebra semantics of datatypes. This is both a blessing and a curse. It is a blessing because the underlying theory is beautiful and well developed. It is a curse because the initial algebra semantics is restricted to so-called regular datatypes. Recent work by R.~Bird and L.~Meertens [3] on the semantics of non-regular or nested datatypes suggests that an extension to general datatypes is not entirely straightforward. Here we propose an alternative that extends polytypism to arbitrary datatypes, including nested datatypes and mutually recursive datatypes. The central idea is to use rational trees over a suitable set of functor symbols as type arguments for polytypic functions. Besides covering a wider range of types the approach is also simpler and technically less involving than previous ones. We present several examples of polytypic functions, among others polytypic reduction and polytypic equality. The presentation assumes some background in functional and in polytypic programming. A basic knowledge of monads is required for some of the examples. |

reference: | Ralf Hinze (1999),
Polytypic Functions Over Nested Datatypes,
Discrete Mathematics and Theoretical Computer Science 3, pp. 193-214 |

ps.gz-source: | dm030407.ps.gz (57 K) |

ps-source: | dm030407.ps (185 K) |

pdf-source: | dm030407.pdf (154 K) |

The first

*source*gives you the `gzipped' PostScript, the second the plain PostScript and the third the format for the Adobe accrobat reader. Depending on the installation of your web browser, at least one of these should (after some amount of time) pop up a window for you that shows the full article. If this is not the case, you should contact your system administrator to install your browser correctly.

Automatically produced on Mon Jun 19 17:42:44 CEST 2000 by novelli