[Haskell-cafe] Return of the revenge of the revisit of the extensible records, reiterated

AntC anthony_clayden at clear.net.nz
Wed Nov 27 21:24:35 UTC 2013

> Atze van der Ploeg <atzeus <at> gmail.com> writes:
> Extensible records have been a long outstanding feature request for GHC.

Yes, that's because getting it right is difficult
-- even if there were strong agreement on the objectives.

> Using the new closed type families and type literals,
> it is actually possible to implement 
> Daan Leijen's "`Extensible Records with Scoped Labels" 
> system as a library. 

Atze, I apologise for pouring cold water on your efforts,
but the only merit of Leijen's proposal is that it's
 (relatively) easy to implement.

It's been "actually possible" at least since HList showed the way.

This from Leijen's abstract:
"A novel aspect of this work is that records can contain duplicate 
labels, ..."
tells why it's easy to implement.

It also tells why it's completely pointless.

So if [**] what you've implemented allows duplicate labels
in a record, I do not want it.
(In fact, I wouldn't call it a record system.)
Please refer to text books on the Relational Model,
as to why it's a BAD THING.
It's a big weakness in SQL, for example,
but SQL doesn't get it as badly wrong as Leijen's proposal.

The difficult part of extensible records is exactly avoiding duplicate 
labels. TRex achieved it, but needed costly language extensions.
HList achieves it, using a fragile combination of extensions
(and giving impenetrable type errors if your program gets it wrong).

I think our best hope of building something workable
is when Richard's overlapping/closed type functions gets into 
the language (and we probably have to allow time 
for the wrinkles to get ironed out).

[**] I can't see from the docos whether you do allow duplicate labels.
Since you refer to Leijen, I assume so.
If you don't, I suggest you avoid the reference.
There's plenty of other (better) proposals out there.


More information about the Haskell-Cafe mailing list