Title: Marker-driven magic-do: build do-chunks from `EffectRunArg` semantics, not `bindE`/`pureE` names · Issue #228 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Marker-driven magic-do: build do-chunks from `EffectRunArg` semantics, not `bindE`/`pureE` names · Issue #228 · purescript-lua/purescript-lua
X Title: Marker-driven magic-do: build do-chunks from `EffectRunArg` semantics, not `bindE`/`pureE` names · Issue #228 · purescript-lua/purescript-lua
Description: Magic-do recognises Effect/ST do-chains by name: it matches the bindE/pureE dictionary methods, flattens the chain into do-chunks, and marks each statement's run with the synthetic EffectRunArg application. The downstream passes are alre...
Open Graph Description: Magic-do recognises Effect/ST do-chains by name: it matches the bindE/pureE dictionary methods, flattens the chain into do-chunks, and marks each statement's run with the synthetic EffectRunArg app...
X Description: Magic-do recognises Effect/ST do-chains by name: it matches the bindE/pureE dictionary methods, flattens the chain into do-chunks, and marks each statement's run with the synthetic EffectRunArg...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/228
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Marker-driven magic-do: build do-chunks from `EffectRunArg` semantics, not `bindE`/`pureE` names","articleBody":"Magic-do recognises `Effect`/`ST` do-chains by name: it matches the `bindE`/`pureE` dictionary methods, flattens the chain into do-chunks, and marks each statement's run with the synthetic `EffectRunArg` application. The downstream passes are already built around the marker rather than the names: DCE keeps a result-unused effect statement via `isEffectRun`, `betaReduce` refuses to reduce an effect-run redex, and codegen erases the marker back to a plain call (and, since #226, sheds the literal thunk under it).\n\nThe name recognition is the fragile half. Anything that renames, inlines, or lifts the Effect core before magic-do runs blinds it. #227 makes this concrete: once the foreign lifter handles multi-parameter literals, `bindE` and `pureE` become technically liftable (their bodies are pure return trees), and allowlisting them would dissolve the bind chains in the optimizer fixpoint before magic-do ever sees them. That loses the flat do-chunks and with them the handling of Lua's nesting and locals limits (#19). Today the only protection is a warning comment next to the allowlist, and the broader-allowlist work (#187) keeps raising the exposure.\n\nThe direction is to invert the dependency. Normalise every effect run to the `EffectRunArg` marker before magic-do, and let magic-do build do-chunks from the marker semantics (an application of the marker is the run of a suspended action) instead of recognising dictionary names. Lifting or inlining the Effect core then stops being dangerous by construction, and the guardrail comment becomes obsolete.\n\nThis is a redesign of magic-do's recognition and of the chunk-boundary strategy that keeps generated functions within Lua's parser-nesting and locals caps (#19), so it needs its own design pass. Split out of the future-direction note in #227.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-11T09:31:55Z","url":"https://github.com/purescript-lua/purescript-lua/issues/228"}
| 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:5fe3adc9-b1af-2582-a076-155ef804f460 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD9A:14F601:9F3541:CE17FF:6B00E052 |
| html-safe-nonce | 0283e7b2d2049ef306fb3877298c7f976a6098c28620f4982b929153376c2815 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDlBOjE0RjYwMTo5RjM1NDE6Q0UxN0ZGOjZCMDBFMDUyIiwidmlzaXRvcl9pZCI6Ijg2MjY0MjUwNTI1NTM4NjMyNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b7b158f5b98da9c9b9f5e82cf8874c00d72d162b75428297d67aadb1f0df940a |
| hovercard-subject-tag | issue:4861619715 |
| 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/228/issue_layout |
| twitter:image | https://opengraph.githubassets.com/feb8460947adc1be43f8c858b573cd3a334b616a4cbd9cfa29556c602ff55916/purescript-lua/purescript-lua/issues/228 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/feb8460947adc1be43f8c858b573cd3a334b616a4cbd9cfa29556c602ff55916/purescript-lua/purescript-lua/issues/228 |
| og:image:alt | Magic-do recognises Effect/ST do-chains by name: it matches the bindE/pureE dictionary methods, flattens the chain into do-chunks, and marks each statement's run with the synthetic EffectRunArg app... |
| 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