Lightweight Extensible Records for Haskell

Early versions of Haskell provied only a positional notation to build and take apart user-de ned datatypes. This positional notation is awkward and error-prone when dealing with datatypes that have more than a couple of components, so later versions of Haskell introduced a mechanism for labeled elds that allows components to be set and extracted by name. While this has been useful in practice, it also has several signi cant problems; for example, no eld name can be used in more than one datatype. In this paper, we present a concrete proposal for replacing the labeledeld mechanisms of Haskell 98 with a more exible system of records that avoids the problems mentioned above. With a theoretical foundation in the earlier work of Gaster and Jones, our system o ers 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.