Title: Graduated @inline directives: arity=N, accessor forms, and a directives file · Issue #232 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Graduated @inline directives: arity=N, accessor forms, and a directives file · Issue #232 · purescript-lua/purescript-lua
X Title: Graduated @inline directives: arity=N, accessor forms, and a directives file · Issue #232 · purescript-lua/purescript-lua
Description: Problem pslua honours only binary @inline always / @inline never on a binding. The abstraction-elimination story (lenses, variants, generics) wants a richer directive DSL bound to a fully-qualified name plus an optional accessor: [export...
Open Graph Description: Problem pslua honours only binary @inline always / @inline never on a binding. The abstraction-elimination story (lenses, variants, generics) wants a richer directive DSL bound to a fully-qualified...
X Description: Problem pslua honours only binary @inline always / @inline never on a binding. The abstraction-elimination story (lenses, variants, generics) wants a richer directive DSL bound to a fully-qualified...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/232
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Graduated @inline directives: arity=N, accessor forms, and a directives file","articleBody":"## Problem\n\npslua honours only binary `@inline always` / `@inline never` on a binding. The abstraction-elimination story (lenses, variants, generics) wants a richer directive DSL bound to a fully-qualified name plus an optional accessor:\n\n```\n[export] qualified-ident accessor? mode\naccessor ::= \"\" -- the value itself\n | \".label\" -- a field of a dictionary record\n | \"...label\" -- a field after application: f(x).member\nmode ::= default | never | always | arity=N (N > 0)\n```\n\n`arity=N` inlines only when applied to at least N arguments, so a tiny curried combinator inlines at saturated sites but stays a reference otherwise; the accessor forms target one dictionary method rather than the whole record; and a `--directives file.txt` supplies these globally, above the built-in heuristics. Without graduated directives pslua cannot start the inlining cascade that eliminates a user-defined abstraction: a fusion pragma like `@inline export overArray arity=1` never gets off the ground.\n\nWorth stating up front: #180 already auto-specializes the non-Effect/ST monads with no directives needed, so the marginal value here is lens/variant/generics elimination and user tuning, not monad collapse.\n\n## Approach\n\nExtend the pragma parser in `IR/Inliner.hs` to accept `arity=N` and the `.label` / `...label` accessor forms, and add a `--directives \u003cfile>` input layering the sources by specificity: a local module-header directive beats the project directives file, which beats `export`-transitive directives, which beat the built-in defaults. At the call site an `arity=N` directive gates inlining on the saturation count already computed for the uncurry pass; the accessor forms attach the policy to a projection out of a known dictionary rather than to the binding as a whole.\n\n## Prerequisites / Relations\n\nIndependent to land; sharper together with the Complexity/Capture lattice, since `default` mode falls back to those heuristics. Enables two follow-ups tracked separately: #241 (auto-inferred directives on synthetic specializations) and #242 (a shipped default-directive pack for the prelude/core forks).\n\n## Verification / Measurement\n\nA curried combinator marked `arity=2` inlines at a saturated two-argument site and stays a reference at a partial one. A focused test covers both. A directives file overrides an exported directive for the same name, and a local module-header directive beats the file (precedence tests). An end-to-end golden where a user abstraction marked `arity=1` collapses through the existing beta / case-of-known-constructor cascade.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-11T12:02:40Z","url":"https://github.com/purescript-lua/purescript-lua/issues/232"}
| 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:b8ccaf33-ef0b-d79c-2097-bccbd3ba5779 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5B6:3D4705:89BF09:B32895:6B00DB58 |
| html-safe-nonce | f5be549eca213e6dc7f0b3b8671469710283b9d03bc419538783211c00af0f0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUI2OjNENDcwNTo4OUJGMDk6QjMyODk1OjZCMDBEQjU4IiwidmlzaXRvcl9pZCI6IjMxNTAxMjc4NDM2MDI2NTE5OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 556117d2c29f11bb7bfe4f06db16e82293762c12704fabceae20fdd76056b0cb |
| hovercard-subject-tag | issue:4862140020 |
| 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/232/issue_layout |
| twitter:image | https://opengraph.githubassets.com/52d33360b315c3b635318f283b39dabe6a52f9525d34395788869df6d0d99bd8/purescript-lua/purescript-lua/issues/232 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/52d33360b315c3b635318f283b39dabe6a52f9525d34395788869df6d0d99bd8/purescript-lua/purescript-lua/issues/232 |
| og:image:alt | Problem pslua honours only binary @inline always / @inline never on a binding. The abstraction-elimination story (lenses, variants, generics) wants a richer directive DSL bound to a fully-qualified... |
| 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