[ghc-steering-committee] Records again

Simon Peyton Jones simonpj at microsoft.com
Tue Dec 17 16:05:00 UTC 2019


|  In order to form a decision about `f r.x = f (r.x)` I also need to
|  know
|  whether I can, for example, align vertically (a very Haskelly desire)
|  without changing meaning:
|  
|     printf "%s %s"  grandfather.first_name  grandfather.last_name
|     printf "%s %s"  mom        .first_name  mom        .last_name
|     printf "%s %s"  (kid!!0   ).first_name  (kid!!0)   .last_name

If we choose (1) for naked selectors then the second and third are illegal because .x is illegal.

If we choose (3) for naked selectors then you can do what you want, but with parens:

|     printf "%s %s"   grandfather.first_name    grandfather.last_name
|     printf "%s %s"  (mom        .first_name)  (mom        .last_name)
|     printf "%s %s"  ((kid!!0   ).first_name)  ((kid!!0)   .last_name)

The parens are only reqd if you want spaces.

Simon


|  -----Original Message-----
|  From: ghc-steering-committee <ghc-steering-committee-
|  bounces at haskell.org> On Behalf Of Joachim Breitner
|  Sent: 17 December 2019 14:26
|  To: ghc-steering-committee at haskell.org
|  Subject: Re: [ghc-steering-committee] Records again
|  
|  Hi,
|  
|  
|  Am Dienstag, den 17.12.2019, 11:46 +0000 schrieb Simon Peyton Jones
|  via
|  ghc-steering-committee:
|  > > I.e. I will support `f r.x = f (r.x)`, if I can still add space
|  before the
|  > > .x.
|  >
|  > That gets into a separate question, the "naked selector" question.
|  There we have the following viable alternatives
|  >
|  > (1) .x is illegal
|  > (2) .x means (\r. r.x)
|  > (3) .x is a postfix operator
|  >
|  > Certainly (3) would all you to write
|  > 	r .x .y        meaning r.x.y
|  > or
|  > 	f (r .x .y)    meaning f (r.x.y)
|  >
|  > But I was trying to close the discussion of (f r.x) before opening
|  the discussion about 1/2/3 for naked selectors.
|  
|  I don't think it can be answered separately. Maybe it can be seen as a
|  clearly separate question if one strongly believes that `r.f` is the
|  roughly the same thing as `M.f`. While I understand that view, I do
|  not
|  strongly believe in it, e.g. because we have `(complex expression).f`
|  and `r.f.g.h`, and this shows me that `e.f` is a more complex and less
|  atomic notion than a qualified name `M.f`.
|  
|  In order to form a decision about `f r.x = f (r.x)` I also need to
|  know
|  whether I can, for example, align vertically (a very Haskelly desire)
|  without changing meaning:
|  
|     printf "%s %s"  grandfather.first_name  grandfather.last_name
|     printf "%s %s"  mom        .first_name  mom        .last_name
|     printf "%s %s"  (kid!!0   ).first_name  (kid!!0)   .last_name
|  
|  
|  (I am not saying that this is universally good style, but it is also
|  not completely unreasonable.)
|  
|  Cheers,
|  Joachim
|  
|  --
|  Joachim Breitner
|    mail at joachim-breitner.de
|  
|  https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
|  oachim-
|  breitner.de%2F&data=02%7C01%7Csimonpj%40microsoft.com%7Cada7e617f6
|  5f48d4bb0608d782fd24de%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63
|  7121896074980463&sdata=QgmqcOorDYvxZZV%2Frwc1D1nI2fgi75cvA7yVRf5H1
|  Ws%3D&reserved=0
|  
|  _______________________________________________
|  ghc-steering-committee mailing list
|  ghc-steering-committee at haskell.org
|  https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail
|  .haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-steering-
|  committee&data=02%7C01%7Csimonpj%40microsoft.com%7Cada7e617f65f48d
|  4bb0608d782fd24de%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6371218
|  96074980463&sdata=kggIGRSDlzD%2FIX2zwO8mWL59ZzK9YzUNcnakt3Qt4EU%3D
|  &reserved=0


More information about the ghc-steering-committee mailing list