Friends
Sorry for dragging my feet here.
Only Joachim, Arnaud, Simon, and Eric responded to my message below. If that means that the rest of you don’t mind either way, that’s fine. But if you have an opinion, please say so in the next 24 hrs.
No one seems keen on (1).
Everyone seems on the fence between (2) and (3).
Personally I prefer (2) over (3). I’m very uncomfortable about an infix white-space operator that binds more tightly than function application. Consider (f .x g .y h .z)
I propose to adopt (2). We can vote if need be, but I’d like to hear from anyone who thinks that’s a wrong choice. Clearly it’s a judgement call.
Simon
From: Simon Peyton Jones <simonpj@microsoft.com>
Sent: 07 January 2020 11:29
To: ghc-steering-committee@haskell.org
Cc: Simon Peyton Jones <simonpj@microsoft.com>
Subject: Record syntax
Friends
I’d like to move our record-syntax discussion forward. Link to
proposal discussion, and
December GHC steering committee debates.
I believe have agreed that
f r.x
(with no spaces around the dot, and no parens around r.x) means
f (r.x)
That is, treat it consistently with qualified names. I asked everyone to express a view; Iavor, Eric, Arnaud, Joachim, and Richard all said it was at least acceptable; others expressed no view. So let’s take that as a decision, at least
for now.
Next question: how should we treat a “naked selector”, namely .x where there is no space after the dot, but there is a space before. I think there are three viable choices:
This choice naturally supports chaining (nice to have, but not essential). We can write
f .map double
.filter isEven
meaning (f.map double).filter isEven
This choice allows us to regard our decision about (f r.x) as what naturally happens if we parse it as three lexemes: f, r, and .x. But it also breaks the “function application binds more tightly than anything else” rule, just as
(f r {x=3}) sadly does already.
It does not permit chaining, at least not without stacked-up parens.
In all three cases we allow (.x), meaning (\r. r.x). For (2) and (3) we can regard it as a “section”, like infix operators only simpler because there is no argument.
I think this is the last major question we have to answer.
What are your views? Personally I lean towards (2), but I could certainly live with (1). I’m a bit reluctant to adopt (3).
Simon