René's URL Explorer Experiment


Title: Derive transitive inline directives on specialization bindings by Unisay · Pull Request #324 · purescript-lua/purescript-lua · GitHub

Open Graph Title: Derive transitive inline directives on specialization bindings by Unisay · Pull Request #324 · purescript-lua/purescript-lua

X Title: Derive transitive inline directives on specialization bindings by Unisay · Pull Request #324 · purescript-lua/purescript-lua

Description: Closes #241. Problem With graduated @inline directives in place (#232), a directive names the generic combinator, but the bindings that actually appear at call sites are often its specializations: purs's common-subexpression pass floats a repeated dictionary application into a top-level binding (bind = Control.Bind.bind bindStateT, verbatim from real CoreFn output), and users write the same shape by hand as top-level partial applications. None of these carry a directive of their own, so each had to be annotated by hand for the directive to keep working through the indirection. Mechanism The arity=N policy composes over application, which is what makes derivation mechanical. For a binding a = f x₁ … xₖ where f carries arity=N: when k < N, a call site applying N − k more arguments to a reconstructs — once a's right-hand side is pasted there — a site applying at least N arguments to f, exactly a qualifying site of the explicit directive, so a inherits arity=(N − k); when k ≥ N, the right-hand side is itself already a qualifying call, so every use of a stands for the specialized value and a inherits always-inline (the arity=0 reading of the same arithmetic). An explicit directive on the specialization always wins over derivation. The rationale lives in Note [Derived inline directives]. The optimizer pipeline is now split into two phases around the derivation point (OptimizerPhases). Derivation reads the module settled by the post-merge optimize+dce fixpoint rather than the pristine input: a specialization referenced once has already dissolved into its use site by then, so only the shared survivors are inspected. It runs before the uncurry worker/wrapper split, so a derived arity joins the uncurry veto like an explicit one, and before the post-uncurry fixpoint, whose whole-binding inlining performs the derived always-inline pastes; derived arities paste at qualifying call sites in the specialize fixpoint exactly like explicit ones. One left-to-right fold over the bindings both derives transitively (a standalone binding references only earlier bindings, so a chain of specializations resolves in a single pass) and bounds the derivation. End to end Golden.DirectiveDerived.Test carries -- @inline combine arity=2 on a three-parameter function too big for any heuristic paste, plus two pragma-free specializations: onePlusTwo = combine 1 2 (saturated at the directed arity) and oneOnly = combine 1 (one argument short). Before this change both survive as shared bindings and every site calls them (from the golden committed with the spec commit): local Golden_DirectiveDerived_Test_onePlusTwo = function(c_S_0) return c_S_0 - 1 - 1 - 2 - 2 - 1 - 3 - 2 - 4 - 1 - 5 - 2 - 6 - 1 - 7 - 2 - 8 - 1 - 9 - 2 - 10 - 1 - 11 - 2 - 12 - 1 - 13 - 2 - 14 - 1 - 15 - 2 - 16 - 1 - 17 - 2 - 18 - 1 - 19 - 2 - 20 end -- ... local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_DirectiveDerived_Test_onePlusTwo(100)))() local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_DirectiveDerived_Test_onePlusTwo(200)))() local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_DirectiveDerived_Test_oneOnly(50)(60)))() After: onePlusTwo derives always-inline, pastes at both sites and folds to constants; oneOnly derives arity=1, pastes at its applied site, and stays a pinned shared binding for the bare use that passes it to a function: local _ = Effect_Console_log(Data_Show_showIntImpl(-140))() local _ = Effect_Console_log(Data_Show_showIntImpl(-40))() local _ = Effect_Console_log(Data_Show_showIntImpl(-660))() return Effect_Console_log(Data_Show_showIntImpl(Golden_DirectiveDerived_Test_apply34(Golden_DirectiveDerived_Test_oneOnly)))() end)() The hand-written eval oracle (-140, -40, -660, -246) passes in both states, so the transform is semantics-preserving. The corefn for this module also shows purs's CSE emitting genuine synthetic floats (sub = Data.Ring.sub ringInt, show = Data.Show.show showInt, discard = Control.Bind.discard discardUnit bindEffect) — the shapes this derivation exists for, once the default directive pack (#242) names their targets. Tests Four pipeline-level specs (derives directives for specializations) cover the saturated and under-applied derivations, transitivity through a chain (an inner specialization deriving from an outer one's derived entry, kept alive through the settle phase by a second use), and the explicit-directive precedence guard; three were red before the implementing commit. The golden module exercises the module-header pragma path end to end. No other golden moved: the corpus carries no arity= directives yet, so derivation fires nowhere else.

Open Graph Description: Closes #241. Problem With graduated @inline directives in place (#232), a directive names the generic combinator, but the bindings that actually appear at call sites are often its specializations: ...

X Description: Closes #241. Problem With graduated @inline directives in place (#232), a directive names the generic combinator, but the bindings that actually appear at call sites are often its specializations: ...

Opengraph URL: https://github.com/purescript-lua/purescript-lua/pull/324

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c4c9841c-6431-0720-8041-4c80fd325b42
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE32C:C2718:9C99A9:CC3A19:6B00E490
html-safe-nonce8812fed767d32ccd72cbc8a82e3333be81dbba1ae4e4b0433d537d54ccea4009
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzJDOkMyNzE4OjlDOTlBOTpDQzNBMTk6NkIwMEU0OTAiLCJ2aXNpdG9yX2lkIjoiNzgzMDQwNjE5OTE0NDE0NjA2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9348f5cc52b51fd7d5397efb9cc41350d5ac39be9bc89055ac0413fd86542103
hovercard-subject-tagpull_request:4145166487
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/purescript-lua/purescript-lua/pull/324/files
twitter:imagehttps://avatars.githubusercontent.com/u/1009751?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1009751?s=400&v=4
og:image:altCloses #241. Problem With graduated @inline directives in place (#232), a directive names the generic combinator, but the bindings that actually appear at call sites are often its specializations: ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git
octolytics-dimension-user_id131581790
octolytics-dimension-user_loginpurescript-lua
octolytics-dimension-repository_id587200487
octolytics-dimension-repository_nwopurescript-lua/purescript-lua
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id587200487
octolytics-dimension-repository_network_root_nwopurescript-lua/purescript-lua
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release624179fb8b88d26ba5bba08894eb60a1c5a1d93d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/purescript-lua/purescript-lua/pull/324/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F324%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F324%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=purescript-lua%2Fpurescript-lua
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/324/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/324/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/324/files
purescript-luahttps://github.com/purescript-lua
purescript-luahttps://github.com/purescript-lua/purescript-lua
Codehttps://github.com/purescript-lua/purescript-lua
Issues48 (48)https://github.com/purescript-lua/purescript-lua/issues
Pull requestshttps://github.com/purescript-lua/purescript-lua/pulls
Discussionshttps://github.com/purescript-lua/purescript-lua/discussions
Actionshttps://github.com/purescript-lua/purescript-lua/actions
Projectshttps://github.com/purescript-lua/purescript-lua/projects
Security and qualityhttps://github.com/purescript-lua/purescript-lua/security
Insightshttps://github.com/purescript-lua/purescript-lua/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2Fnew%2Fchoose
Unisayhttps://github.com/Unisay
mainhttps://github.com/purescript-lua/purescript-lua/tree/main
issue-241/derived-inline-directiveshttps://github.com/purescript-lua/purescript-lua/tree/issue-241/derived-inline-directives
Conversation 0 https://github.com/purescript-lua/purescript-lua/pull/324
Commits 2 https://github.com/purescript-lua/purescript-lua/pull/324/commits
Checks 2 https://github.com/purescript-lua/purescript-lua/pull/324/checks
Files changed https://github.com/purescript-lua/purescript-lua/pull/324/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
Derive transitive inline directives on specialization bindings https://github.com/purescript-lua/purescript-lua/pull/324/files#top
Show all changes 2 commits https://github.com/purescript-lua/purescript-lua/pull/324/files
7bc0a7f test(optimizer): specs for derived inline directives (#241) Unisay Jul 27, 2026 https://github.com/purescript-lua/purescript-lua/pull/324/commits/7bc0a7fc7ff66f6d24bf0c643d024b8e82223da2
ed2f72e feat(optimizer): derive inline directives on specializations (#241) Unisay Jul 27, 2026 https://github.com/purescript-lua/purescript-lua/pull/324/commits/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b
Clear filters https://github.com/purescript-lua/purescript-lua/pull/324/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
README.md https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
20260727_200000_unisay_derived_inline_directives.md https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-ab317f1ceb40008faccd2084b2a100750f34b37b72abbbaa56371570318ec2b9
Optimizer.hs https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
Spec.hs https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
corefn.json https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-7bae873789447df611d085ac5934a12aebc483cfcd80b51509570386bfbdbe16
.gitignore https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-9c66112c8942301f57a5e7d893c0d90d9f82a9377476f545c6e0c5989feee8d3
golden.txt https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-09d9100e4226fd6607d85693e281a2b4a23394129ea362bdd82feee34c3cb077
golden.ir https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-c2fd7003639eb3d21d90833b9f38fc0d173523249bcf4fcd9f20bf5951d1eda8
golden.lua https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-2698df1e6149f4818ed9b12bf1c4b8d0e73af223ab01c5e29efc8b97b38260d9
Test.purs https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-bea6dea8f2c713c2ebf6296df5bfbba344ce231904dbd721a40017acca0450be
README.mdhttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/324/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
changelog.d/20260727_200000_unisay_derived_inline_directives.mdhttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-ab317f1ceb40008faccd2084b2a100750f34b37b72abbbaa56371570318ec2b9
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/changelog.d/20260727_200000_unisay_derived_inline_directives.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/324/{{ revealButtonHref }}
lib/Language/PureScript/Backend/IR/Optimizer.hshttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/lib/Language/PureScript/Backend/IR/Optimizer.hs
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
test/Language/PureScript/Backend/IR/Optimizer/Spec.hshttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/324/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/324/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
test/ps/output/Golden.DirectiveDerived.Test/corefn.jsonhttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-7bae873789447df611d085ac5934a12aebc483cfcd80b51509570386bfbdbe16
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/test/ps/output/Golden.DirectiveDerived.Test/corefn.json
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
test/ps/output/Golden.DirectiveDerived.Test/eval/.gitignorehttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-9c66112c8942301f57a5e7d893c0d90d9f82a9377476f545c6e0c5989feee8d3
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/test/ps/output/Golden.DirectiveDerived.Test/eval/.gitignore
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/324/{{ revealButtonHref }}
test/ps/output/Golden.DirectiveDerived.Test/eval/golden.txthttps://github.com/purescript-lua/purescript-lua/pull/324/files#diff-09d9100e4226fd6607d85693e281a2b4a23394129ea362bdd82feee34c3cb077
View file https://github.com/purescript-lua/purescript-lua/blob/ed2f72ec3d1c6b81c0958e137c3a60336b4faf1b/test/ps/output/Golden.DirectiveDerived.Test/eval/golden.txt
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/324/{{ revealButtonHref }}
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/324/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.