Records in Haskell

AntC anthony_clayden at
Fri Mar 9 05:49:37 CET 2012

> On Fri, Mar 02, 2012 at 01:04:13AM +0000, AntC wrote:
> > 
> > Let me explain better what I mean by "two private namespaces", then we'll 
> >  try to understand how your proposal goes ...

Folks, it has been very difficult keeping up with all the twists and turns of 
this thread.

So here's a summary of my proposal, by popular demand,

Reminder about this approach:
 * It requires no new semantics from Haskell (beyond ghc v7.2 extensions).
 * Therefore a prototype can be developed,
   and it has! you can download and see for yourself.
 * The syntax for record updates is the same as it is today.
   (Although the semantics is polymorphic, not monomorphic.)
 * The syntax for data declarations is the same as it is today.
 * The syntax for field selection is the same as it is today.
   (But polymorphic for any record with a field of that name.)
 * There is a dot notation syntax possible for field selection,
   (strictly optional, sugar only).
 * It does support type-changing update to records,
   for parametric polymorphic fields and records.

 * This approach does not have a solution for updating fields of
   higher-rank types.
   (In that respect it is like SORF. This is the remaining problem.
    And I suspect that any solution for SORF will equally work for DORF.)

There were some criticisms about how much boilerplate this approach would 
need. There are some ideas/suggestions to improve that. In particular 
see "Option Three: Mixed In-situ and Declared ORF" further down the page from 
the Thumbnail Sketch.

Constructive feedback welcome.


More information about the Glasgow-haskell-users mailing list