Hostname: page-component-cd9895bd7-lnqnp Total loading time: 0 Render date: 2024-12-23T04:18:10.956Z Has data issue: false hasContentIssue false

Do we need dependent types?

Published online by Cambridge University Press:  03 November 2000

DANIEL FRIDLENDER
Affiliation:
BRICS
Basic Research in Computer Science, Centre of the Danish National Research Foundation.
, Department of Computer Science, University of Aarhus, Århus, Denmark (e-mail: daniel@brics.dk)
MIA INDRIKA
Affiliation:
Department of Computing Science, Chalmers University of Technology and Göteborg University, Göteborg, Sweden (e-mail: indrika@cs.chalmers.se)
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.

This pearl is about some functions whose definitions seem to require a language with dependent types. We describe a technique for defining them in Haskell or ML, which are languages without dependent types.

Consider, for example, the scheme defining zipWith in figure 1. When this scheme is instantiated with n equal to 1 we obtain the standard function map. In practice, other instances of the scheme are often useful as well.

Figure 1 cannot be used as a definition of a function in Haskell because of the ellipses ‘...’. More importantly, the type of zipWith is parameterized by n, which seems to indicate the need for dependent types. However, as mentioned above, Haskell does not allow dependent types.

Type
FUNCTIONAL PEARL
Copyright
© 2000 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.