Haskell records compare Standard ML

Thanks, I’ll reorder the points in your post (and look at the Lazy ML links later – although I’d already had a quick look at ML before starting this thread). Mostly I’m going to repeat what’s already been said up-thread …

And @sclv quoted that passage way up-thread. (And I was already very well aware of it.) The part you omitted shows this was describing the position as at 1993, not 2007 when that paper appeared. So nothing had improved in the preceding decade? Not true: Mark P Jones had designed and got working two distinct approaches for records in a Haskell. Indeed both working simultaneously (albeit primitively) before the H98 standard.

In 2007 that was documenting the history (the what). It’s not adequate as an explanation for me (the why). To continue to make that claim two decades further on with all the advances in higher-order/System-F-with-bangles/Dependent Haskell says to me: GHC doesn’t care.

I can’t speak as a compiler implementer nor type theorist. The usual Haskell way is to review “the huge number of” prior designs for feature X; boil them down to some underlying mechanism; express that in the type system. As at 2007 – even as at a decade later – GHC tolerated multiple competing designs in the same feature-space, and that’s probably what would be needed. To this day we still have FunctionalDependencies and TypeFamilies and OverlappingInstances and UndecidableInstances, with none of them withering away.

(Fair question: am I just whinging/asking for the impossible?)

  • Spinoffs most obviously purescript, which I mentioned. They don’t seem to have wasted time wringing their hands about ‘ideal’ designs.

  • Haskells: Hugs/Trex, and new improved Hugs/Trex. (I’m not blowing my own trumpet/it’s nothing to be proud of. If even a non-compiler non-propellor-head like me can hack in C++, why can’t GHC do a much better job?)

  • In purescript it seems to be by a thin veneer over the javascript implementation. (Yes, you might call that cheating, but it does have to mesh with purescript’s type system.)

  • In Hugs/Trex there’s an extension to the H98 type system, Section 3 of the paper – which today we’d recognise as PolyKinds.

  • In my improvements, I’ve relied on FunDeps and Overlapping instances – having first slightly liberalised the Hugs implementation of them; but never allowing the porridge of behaviour in GHC.

  • So (full disclosure) the 1996~2006 Hugs/Trex implementation allowed ‘magic’ auto-instances for record access that an end-user couldn’t write for themselves. By easing the FunDep/Overlap rules – just a little, I’m now not needing such magic.