Type classes with existential types
- 1 January 1996
- journal article
- research article
- Published by Cambridge University Press (CUP) in Journal of Functional Programming
- Vol. 6 (3) , 485-518
- https://doi.org/10.1017/s0956796800001817
Abstract
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.Keywords
This publication has 19 references indexed in Scilit:
- Signatures: A language extension for improving type abstraction and subtype polymorphism in C++Software: Practice and Experience, 1995
- Polymorphic type inference and abstract data typesACM Transactions on Programming Languages and Systems, 1994
- Simple type-theoretic foundations for object-oriented programmingJournal of Functional Programming, 1994
- Programming objects with ML-ART an extension to ML with abstract and record typesPublished by Springer Nature ,1994
- Report on the programming language HaskellACM SIGPLAN Notices, 1992
- Type classes and overloading resolution via order-sorted unificationPublished by Springer Nature ,1991
- Abstract types have existential typeACM Transactions on Programming Languages and Systems, 1988
- Parametric overloading in polymorphic programming languagesPublished by Springer Nature ,1988
- An ideal model for recursive polymorphic typesInformation and Control, 1986
- On understanding types, data abstraction, and polymorphismACM Computing Surveys, 1985