[ghc-steering-committee] RecordDotSyntax: please express a view

Simon Peyton Jones simonpj at microsoft.com
Tue Dec 10 14:56:53 UTC 2019


According to my table, we have two prefix `.`s. These are field accesses. Just like the tight infix positioning of `.`. So, (f a .b c .d e) means the exact same thing as (f a.b c.d e), which is, presumably (f (a.b) (c.d) e).

So `.x` behaves like a postfix operator with precedence tighter than function application.   Indeed, personally, I don't like that!

Also I realise that it might be good to write

  xs  .map double

      .filter isEven

      .map square
and that would indeed be what you could say with a postfix operator.  It would parse as

  (((xs.map) double).filter isEven).map square

Simon

From: Richard Eisenberg <rae at richarde.dev>
Sent: 10 December 2019 14:33
To: Simon Peyton Jones <simonpj at microsoft.com>
Cc: Joachim Breitner <mail at joachim-breitner.de>; ghc-steering-committee at haskell.org
Subject: Re: [ghc-steering-committee] RecordDotSyntax: please express a view




On Dec 10, 2019, at 2:27 PM, Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:

|  To be concrete, I propose this:

Not concrete enough.  I don't understand

|  prefix             with a ( before the .: field selector
|                     otherwise: field access

What does (f a .b c .d e) mean?

According to my table, we have two prefix `.`s. These are field accesses. Just like the tight infix positioning of `.`. So, (f a .b c .d e) means the exact same thing as (f a.b c.d e), which is, presumably (f (a.b) (c.d) e).

Perhaps that's not what we like. But it is simple and comes straight from my table. And it is not too bad for programmers: prefix `.` is *just like* tight infix `.`. The only exception is at the beginning of a section, where tight-infix does not make sense.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20191210/c321dbcc/attachment-0001.html>


More information about the ghc-steering-committee mailing list