Generics for the working ML'er

  • Authors:
  • Vesa A.J. Karvonen

  • Affiliations:
  • University of Helsinki, Helsinki, Finland

  • Venue:
  • ML '07 Proceedings of the 2007 workshop on Workshop on ML
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Generic values are type-indexed values defined over the structure of types. A popular and pragmatic approach to type-indexed values in ML-like languages is to use a value-dependent encoding,where the type representations carry the values being indexed. Unfortunately, the approach has a major drawback. Because the resulting encoding is specific to a particular set of values, extending an encoding with new values requires modifying it.In this paper, we discuss an approach to generics based on the value-dependent encoding approach. We extend upon previous work inseveral ways. We present a technique that allows an existing value-dependent encoding to be extended with new values. We show how toencode type representations over essentially all the ML-types. We also show how to compute fixed points over arbitrary products. Our techniques have been implemented in Standard ML, do not compromise abstraction, and require only a fixed number of combinators.