Inferring Type Isomorphisms Generically

  • Frank Atanassow
  • Johan Jeuring
Conference paper

DOI: 10.1007/978-3-540-27764-4_4

Part of the Lecture Notes in Computer Science book series (LNCS, volume 3125)
Cite this paper as:
Atanassow F., Jeuring J. (2004) Inferring Type Isomorphisms Generically. In: Kozen D. (eds) Mathematics of Program Construction. MPC 2004. Lecture Notes in Computer Science, vol 3125. Springer, Berlin, Heidelberg

Abstract

Datatypes which differ inessentially in their names and structure are said to be isomorphic; for example, a ternary product is isomorphic to a nested pair of binary products. In some canonical cases, the conversion function is uniquely determined solely by the two types involved. In this article we describe and implement a program in Generic Haskell which automatically infers this function by normalizing types w.r.t. an algebraic theory of canonical isomorphisms. A simple generalization of this technique also allows to infer some non-invertible coercions such as projections, injections and ad hoc coercions between base types. We explain how this technique has been used to drastically improve the usability of a Haskell–XML Schema data binding, and suggest how it might be applied to improve other type-safe language embeddings.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Frank Atanassow
    • 1
  • Johan Jeuring
    • 1
  1. 1.Institute of Information & Computing SciencesUtrecht UniversityThe Netherlands

Personalised recommendations