Journal of Functional Programming



Article

Type-safe run-time polytypic programming


STEPHANIE WEIRICH a1
a1 Department of Computer and Information Science, University of Pennsylvania, Philadelphia, PA 19104, USA

Article author query
weirich s   [Google Scholar] 
 

Abstract

Polytypic programming is a way of defining type-indexed operations, such as map, fold and zip, based on type information. Run-time polytypic programming allows that type information to be dynamically computed – this support is essential in modern programming languages that support separate compilation, first-class type abstraction, or polymorphic recursion. However, in previous work we defined run-time polytypic programming with a type-passing semantics. Although it is natural to define polytypic programs as operating over first-class types, such a semantics suffers from a number of drawbacks. This paper describes how to recast that work in a type-erasure semantics, where terms represent type information in a safe manner. The resulting language is simple and easy to implement – we present a prototype implementation of the necessary machinery as a small Haskell library.

(Published Online February 28 2006)