Hostname: page-component-77f85d65b8-6c7dr Total loading time: 0 Render date: 2026-03-26T21:19:44.975Z Has data issue: false hasContentIssue false

Type classes with existential types

Published online by Cambridge University Press:  07 November 2008

Konstantin Läufer
Affiliation:
Department of Mathematical and Computer Sciences, Loyola University of Chicago, 6525 North Sheridan Road, Chicago, IL 60626, USA (e-mail: laufer@math.luc.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.

We argue that the novel combination of type classes and existential types in a single language yields significant expressive power. We explore this combination in the context of higher-order functional languages with static typing, parametric polymorphism, algebraic data types and Hindley–Milner type inference. Adding existential types to an existing functional language that already features type classes requires only a minor syntactic extension. We first demonstrate how to provide existential quantification over type classes by extending the syntax of algebraic data type definitions, and give examples of possible uses. We then develop a type system and a type inference algorithm for the resulting language. Finally, we present a formal semantics by translation to an implicitly-typed second-order λ-calculus and show that the type system is semantically sound. Our extension has been implemented in the Chalmers Haskell B. system, and all examples from this paper have been developed using this system.

Information

Type
Articles
Copyright
Copyright © Cambridge University Press 1996
Submit a response

Discussions

No Discussions have been published for this article.