Leveling up dependent types: generic programming over a predicative hierarchy of universes

  • Authors:
  • Larry Diehl;Tim Sheard

  • Affiliations:
  • Portland State University, Portland, OR, USA;Portland State University, Portland, OR, USA

  • Venue:
  • Proceedings of the 2013 ACM SIGPLAN workshop on Dependently-typed programming
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

Generic programming is about writing a single function that does something different for each type. In most languages one cannot case over the structure of types. So in such languages generic programming is accomplished by defining a universe, a data structure isomorphic to some subset of the types supported by the language, and performing a case analysis over this datatype instead. Such functions support a limitied level of genericity, limited to the subset of types that the universe encodes. The key to full genericity is defining a rich enough universe to encode all types in the language. In this paper we show how to define a universe with a predicative hierarchy of types, encoding a finite set of base types (including dependent products and sums), and an infinite set of user defined datatypes. We demonstrate that such a system supports a much broader notion of generic programming, along with a serendipitous extension to the usefulness of user defined datatypes with existential arguments.