Hostname: page-component-7479d7b7d-68ccn Total loading time: 0 Render date: 2024-07-12T13:56:34.575Z Has data issue: false hasContentIssue false

Two-level types and parameterized modules

Published online by Cambridge University Press:  06 August 2004

TIM SHEARD
Affiliation:
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)
EMIR PASALIC
Affiliation:
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)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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.

Type
Article
Copyright
© 2004 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.