Two-level types and parameterized modules

  • Authors:
  • Tim Sheard;Emir Pasalic

  • Affiliations:
  • OGI School of Science & Engineering, Oregon Health & Science University, 20000 N.W. Walker Road, Beaverton, OR 97006-8921, USA (e-mail: sheard@cse.ogi.edu, pasalic@cse.ogi.edu);OGI School of Science & Engineering, Oregon Health & Science University, 20000 N.W. Walker Road, Beaverton, OR 97006-8921, USA (e-mail: sheard@cse.ogi.edu, pasalic@cse.ogi.edu)

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

Quantified Score

Hi-index 0.00

Visualization

Abstract

In this paper, we describe two techniques for the efficient, modularized implementation of a large class of algorithms. We illustrate these techniques using several examples, including efficient generic unification algorithms that use reference cells to encode substitutions, and highly modular language implementations. We chose these examples to illustrate the following important techniques that we believe many functional programmers would find useful. First, defining recursive data types by splitting them into two levels: a structure defining level, and a recursive knot-tying level. Second, the use of rank-2 polymorphism inside Haskell's record types to implement a kind of type-parameterized modules. Finally, we explore techniques that allow us to combine already existing recursive Haskell data-types with the highly modular style of programming proposed here.