Extensible records with scoped labels
Proceedings of the 2005 Symposium on Trends in Functional Programming (TFP'05), Tallin, Estonia |
Records provide a safe and flexible way to construct data structures. We describe a natural approach to typing polymorphic and extensible records that is simple, easy to use in practice, and straightforward to implement. A novel aspect of this work is that records can contain duplicate labels, effectively introducing a form of scoping over the labels. Furthermore, it is a fully orthogonal extension to existing type systems and programming languages. In particular, we show how it can be used conveniently with standard Hindley-Milner, qualified types, and ML-F. The records are implemented in the experimental Morrow interpreter. There is separate technical report that gives the constructive proofs of soundness and completeness.