In early versions of Haskell, the only direct way to construct values of user-defined datatypes was by applying a constructor function to an appropriate sequence of arguments, and the only direct way to extract component values was by pattern matching. Both rely on a positional notation for datatype components, which is awkward and error-prone when dealing with datatypes that have more than a couple of components. To remedy some of these problems, later versions of Haskell introduced a mechanism for labeled fields that allows components to be set and extracted by using the name of an associated selector function. While this has been useful in practice, it also has several significant problems. For example, record types are not lightweight because they must be declared before values of those types can be constructed. More seriously, no field name can be used in more than one datatype.

In this paper, we present a concrete proposal for replacing the labeled field mechanisms of Haskell with a more flexible system of records that avoids the problems described above. With a theoretical foundation in the earlier work of Gaster and Jones, our system offers lightweight, extensible records and a complement of polymorphic operations for manipulating them. On a more concrete level, our proposal is a direct descendent of the Trex implementation (“typed records with extensibility”) in Hugs, but freed from the constraints of that setting, where compatibility with Haskell 98 was a major concern.