Records in Haskell
anthony_clayden at clear.net.nz
Tue Feb 28 11:17:54 CET 2012
Barney Hilken <b.hilken <at> ntlworld.com> writes:
> After more pondering, I finally think I understand what the DORFistas want.
1) please don't personalise. I designed DORF, built a proof of concept, got it
running, asked for feedback (got some very useful thoughts from SPJ), built a
prototype, posted the wiki pages. I'm not a "DORFista"; I'm somebody who wants
to improve the Haskell records namespace issue.
2) whether or not you think you know what some people want, you don't
understand DORF, and you've mixed it up with SORF. You've then caused a great
long thread of confusion.
In particular, at exactly where DORF is designed to avoid (what I see as) a
weakness in SORF, you've alleged DORF has that weakness.
>Here is an example:
(by the way, you've used SORF syntax in those examples)
> It doesn't make any sense to apply your functions to my records or vice-
Exactly! and that's what the DORF design avoids, whereas SORF suffers from it.
> but because we both chose the
> same label,
SORF uses the "same label" in the sense of the same String Kind.
> the compiler allows it. Putting the code in separate modules makes no
> labels are global.
DORF's labels are not global, they're proxy _types_ so that the scope is
controlled in the usual way. So using separate modules makes all the
> Here is a simple solution, using SORF:
I think your "solution" would work just as well 'translated' into DORF.
(But then it's a "solution" to something that isn't a problem in DORF.)
>... than building the mechanism in to the language as DORF does, ...
DORF is not "building the mechanism in to the language", nor is it introducing
any new language features, only sugar. The prototype runs in GHC v7.2.1. All
I've done is hand-desugarred. (Look at it for yourself, it's attached to the
SORF, on the other hand, needs user-defined Kinds, which are only just being
introduced in v7.4, and don't yet include String Kind.
More information about the Glasgow-haskell-users