Type-safe run-time polytypic programming

  • Authors:
  • Stephanie Weirich

  • Affiliations:
  • Department of Computer and Information Science, University of Pennsylvania, Philadelphia, PA 19104, USA

  • Venue:
  • Journal of Functional Programming
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

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.