Title: Fold ObjectProp field reads over known constructor applications · Issue #213 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Fold ObjectProp field reads over known constructor applications · Issue #213 · purescript-lua/purescript-lua
X Title: Fold ObjectProp field reads over known constructor applications · Issue #213 · purescript-lua/purescript-lua
Description: Problem Constructor field access reaches the IR as an ObjectProp record projection (ObjectProp (Ref v) (PropName "value0")), not as DataArgumentByIndex. This is what the generated workers actually contain: in the Golden.MaybeChain and Go...
Open Graph Description: Problem Constructor field access reaches the IR as an ObjectProp record projection (ObjectProp (Ref v) (PropName "value0")), not as DataArgumentByIndex. This is what the generated workers actually ...
X Description: Problem Constructor field access reaches the IR as an ObjectProp record projection (ObjectProp (Ref v) (PropName "value0")), not as DataArgumentByIndex. This is what the generated workers...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/213
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fold ObjectProp field reads over known constructor applications","articleBody":"## Problem\n\nConstructor field access reaches the IR as an `ObjectProp` record projection (`ObjectProp (Ref v) (PropName \"value0\")`), not as `DataArgumentByIndex`. This is what the generated workers actually contain: in the `Golden.MaybeChain` and `Golden.LongMaybeBind` IR the `bind`/`maybe`/`map` workers read their scrutinee's payload with `ObjectProp … \"value0\"`.\n\nNothing folds that shape. `reduceObjectProp` folds record literals and updates only (#153), and the case-of-known-constructor folds of #177 cover the `DataArgumentByIndex` field-read form only. So `ObjectProp (K a₀ … aₙ) (PropName \"valueᵢ\")` over a syntactically known, saturated constructor is left standing: `(Just 7).value0` does not reduce to `7`, even with the constructor in place.\n\n## Approach\n\nExtend case-of-known-constructor to the record-projection field read. `ObjectProp scrutinee (PropName \"valueᵢ\")`, where `scrutinee` is a saturated `Ctor` application, reduces to `aᵢ`. The label maps to its positional index through the constructor's declared `[FieldName]` (`value0`, `value1`, … are the keys the Lua backend emits for a `Ctor`). The effect discipline matches the existing `DataArgumentByIndex` fold: discarded arguments are dropped rather than evaluated or duplicated, and the folded value takes the read node's own annotation, not the argument's (the leak care of #169 and `reduceObjectProp`).\n\n## Prerequisites / Relations\n\nNothing needs to land first. This is the `ObjectProp` twin of the `DataArgumentByIndex` fold in #177 and the algebraic-type companion of the record-literal fold in #153. It is a prerequisite for #180: the dictionary methods inlined there read constructor payloads through exactly this shape.\n\n## Verification / Measurement\n\nStandalone impact is near zero, since the shape barely occurs before method inlining lands, so the value shows up through the #180 cascade and is measured end to end by #172. Because the rule touches discard semantics, stress the randomized optimizer specs across seeds.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-09T08:49:15Z","url":"https://github.com/purescript-lua/purescript-lua/issues/213"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c9b93f7-a654-8c0d-2b63-68ab7d9cdaab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FE0:19E4BB:639A83:811629:6B00DFC2 |
| html-safe-nonce | cc6c12aa03a473d08f22b11f9c05abfe62f3629f426fa745e16f1fce64823e2d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkUwOjE5RTRCQjo2MzlBODM6ODExNjI5OjZCMDBERkMyIiwidmlzaXRvcl9pZCI6IjU5Mzg2OTkxMTkzMjAxNjIyNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d68cdb2b9e3b5e791b2cb379679a919edc22ede3cb292e727fa07785237fe270 |
| hovercard-subject-tag | issue:4844735069 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/213/issue_layout |
| twitter:image | https://opengraph.githubassets.com/912474a2d628cf47d18a29feb7e4aa682d1de802a63d03dd2cc8da93540e5689/purescript-lua/purescript-lua/issues/213 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/912474a2d628cf47d18a29feb7e4aa682d1de802a63d03dd2cc8da93540e5689/purescript-lua/purescript-lua/issues/213 |
| og:image:alt | Problem Constructor field access reaches the IR as an ObjectProp record projection (ObjectProp (Ref v) (PropName "value0")), not as DataArgumentByIndex. This is what the generated workers actually ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width