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

Richard Eisenberg rae at richarde.dev
Sat Dec 14 11:41:48 UTC 2019


Your very helpful delineation of the space assumes (.) = \ f g x -> f (g x) and then inlines. I actually think it would be clearer not to do this. I have taken your taxonomy and kept (.) abstract. Some examples also left (x.field) uninterpreted. I have expanded these to use getField. To be clear, this is *not* a reproposal or intended to make *any* change to Joachim's dichotomy. I am just restating it a way I understand better. Perhaps others will also find this to be clearer. Each individual committee member can use *either* my presentation or Joachim's. They (are intended to) have *the same* semantics.

Reject:    
 r.field        = (.) r field
 f x.field y    = (.) (f x) (field y)
 f x .field y   = (.) (f x) (field y)
 f x (.field) y = f x (\a -> (.) a field) y
 f x (.field y) = f x (\a -> (.) a (field y))

OnlySelection:
 r.field        = getField @"field" r
 f x.field y    = f (getField @"field" x) y
 f x .field y   -- NOT ALLOWED
 f x (.field) y -- NOPE
 f x (.field y) -- NAY

SectionSelector:
 r.field        = getField @"field" r
 f x.field y    = f (getField @"field" x) y
 f x .field y   -- VERBOTEN!
 f x (.field) y = f x (\r -> getField @"field" r) y
 f x (.field y) -- BAD!

PlainSelector:        -- this is the proposal as it stands, I believe
 r.field        = getField @"field" r
 f x.field y    = f (getField @"field" x) y
 f x .field y   = f x (\r -> getField @"field" r) y
 f x (.field) y = f x (\r -> getField @"field" r) y
 f x (.field y) = f x ((\r -> getField @"field" r) y) = f x (getField @"field" y) -- !

Ocaml: 
 r.field        = getField @"field" r
 f x.field y    = f (getField @"field" x) y
 f x .field y   = f (getField @"field" x) y
 f x (.field) y -- NOT ALLOWED
 f x (.field y) -- CAN’T DO THAT

Ocaml+Section: 
 r.field        = getField @"field" r
 f x.field y    = f (getField @"field" x) y
 f x .field y   = f (getField @"field" x) y
 f x (.field) y = f (\r -> getField @"field" r) y
 f x (.field y) -- NO NO NO

JS: 
 r.field        = getField @"field" r
 f x.field y    = (getField @"field" (f x)) y
 f x .field y   = (getField @"field" (f x)) y
 f x (.field) y -- IMPOSSIBLE!
 f x (.field y) -- STOP IT PLEASE!

JS+Section: 
 r.field        = getField @"field" r
 f x.field y    = (getField @"field" (f x)) y
 f x .field y   = (getField @"field" (f x)) y
 f x (.field) y = f x (\r -> getField @"field" r) y
 f x (.field y) = f x (\r -> (getField @"field" r) y)

I hope this is helpful!
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20191214/f34102ec/attachment-0001.html>


More information about the ghc-steering-committee mailing list