MetaCartSign in to MyCiteSeer

Include Citations | Advanced Search | Help

Include Citations | Advanced Search | Help

  Restricted data types in Haskell (1999) [7 citations — 0 self]

Download:
Download as a PDF | Download as a PS
by John Hughes
Proceedings of the 1999 Haskell Workshop. Number
http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps
Add To MetaCart

Abstract:

The implementations of abstract type constructors must often restrict the type parameters: for example, one implementation of sets may require equality on the element type, while another implementation requires an ordering. Haskell has no mechanism to abstract over such restrictions, which can hinder us from replacing one implementation by another, or making several implementations instances of the same class. This paper proposes a language extension called restricted data types to address this problem. A restricted data type definition specifies a condition which argument types must satisfy for the data type to be well-formed. Every type in a program must be well-formed, and we add an explicit notation to express such requirements. Thus programmers can simply state that a type must be well-formed, rather than repeat its restriction explicitly. We explain our extension via a simulation using multi-parameter classes, which serves to specify its semantics. We show its application to the design of a collection class and to the class of monads, and we discuss extensions to compile-time context reduction needed to implement it.

Citations

83 Generalising monads to arrows – Hughes - 2000
75 Type classes: Exploring the design space – Jones, Jones, et al. - 1997
17 Lightweight extensible records for Haskell – Jones, Jones - 1999
2 Bulk types with class – Peyton-Jones - 1996