[ghc-steering-committee] Precedence of r.x

Spiwack, Arnaud arnaud.spiwack at tweag.io
Thu Dec 12 10:01:52 UTC 2019


When I first picked up Haskell professionally, I was told “we don’t write
f.g, we write f . g, because when someone manages to add the record syntax,
the former will be record selection”. So I’ve always considered f.g to be
forbidden syntax. Morally a syntax error, if you will, that the parser
accidentally didn’t catch.

So, while it is true that *today* f r.x parses as (f r).x (that is, (B)). I
see no objection for (A), which does make more visual sense to me.

On Thu, Dec 12, 2019 at 10:49 AM Simon Marlow <marlowsd at gmail.com> wrote:

> Definitely (A).
>
> On Thu, 12 Dec 2019 at 09:44, Simon Peyton Jones via
> ghc-steering-committee <ghc-steering-committee at haskell.org> wrote:
>
>> A question for the committee.
>>
>> What does
>>         f r.x
>> mean, where there is no white space on either side of the dot?
>>
>> A. The proposal says it means (f (r.x))
>> B. Joachim wants it to mean ((f r).x)
>>
>> In trying to guide the discussion to a conclusion I proposed to fix on
>> (A).  I don't think it was controversial in the public discussion, it's
>> compatible with qualified names, and forcing `f (r.x)` looks horribly
>> clumsy to me.
>>
>> Partly it's a question of whether your starting point is
>> (a) "." is fundamentally an operator, albeit with
>>     some special extra rules, or
>> (b) R.x, r.x, and .x are new syntactic forms,
>>     unrelated to the infix operator (.)
>> I'm definitely thinking of it in the latter way.
>>
>> I don't really want to re-open this question, and I'm not sure if the
>> authors of the proposal could live with (B). However, if the committee
>> wants to reopen the question, then that is what we should do.   Can you
>> express a view on this narrow question?
>>
>> Simon
>> _______________________________________________
>> ghc-steering-committee mailing list
>> ghc-steering-committee at haskell.org
>> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
>>
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20191212/df19791c/attachment-0001.html>


More information about the ghc-steering-committee mailing list