René's URL Explorer Experiment


Title: feat(ir): accumulate match history, prune literal retests by Unisay · Pull Request #263 · purescript-lua/purescript-lua · GitHub

Open Graph Title: feat(ir): accumulate match history, prune literal retests by Unisay · Pull Request #263 · purescript-lua/purescript-lua

X Title: feat(ir): accumulate match history, prune literal retests by Unisay · Pull Request #263 · purescript-lua/purescript-lua

Description: Closes #184. The case decision-tree compiler already pruned redundant constructor-tag tests through MatchHistory, but every literal pattern (integer, float, string, char, boolean, array length) emitted its eq test unconditionally, and the history held a single most-recent slot per scrutinee, so negative knowledge was lost for sum types with three or more constructors. The repro from the issue is Data.String.CodePoints.codePointAt, whose compiled golden re-tested 0 == v in both branches of a test that had already decided it. This PR generalizes MatchHistory from Map Exp (CtorName, Bool) to Map Exp (Map Pattern Bool) and routes all literal patterns through the same consult-then-remember step (testFocus) that constructor tags used. A test whose outcome the history already decides is pruned instead of re-emitted: a known-positive proceeds straight to the next match, and a known-negative (recorded directly, or implied by a mutually exclusive sibling that passed: a different tag of the same type, a different literal of the same kind, a different array length) falls through to the next clause. Since a ProductType tag test is a tautology and nothing can consult its record, it stops recording anything. Mutual exclusion of distinct literals is sound at the Lua level: PureScript Int literals are 32-bit and therefore exact in Lua 5.1 doubles, and the printer's show-roundtrip float text keeps distinct Doubles distinct. The first commit pins the pre-pruning decision trees in a new Golden.CasePruning.Test module (the codePointAt shape, a constructor-tag retest that survives only because the single slot forgot the first of two negatives, and its literal twin), so the second commit shows the pruning as a golden diff. Accepted diffs elsewhere: Data.String.CodePoints.codePointAt loses the nested 0 == v retest with its dead then-branch, Golden.PatternMatching.Test2 loses a dead Zero retest after two accumulated negatives, and Golden.CaseStatements shifts only generated name counters. No eval oracle changed. The full suite passes, and the randomized specs also ran green on several seeds.

Open Graph Description: Closes #184. The case decision-tree compiler already pruned redundant constructor-tag tests through MatchHistory, but every literal pattern (integer, float, string, char, boolean, array length) emi...

X Description: Closes #184. The case decision-tree compiler already pruned redundant constructor-tag tests through MatchHistory, but every literal pattern (integer, float, string, char, boolean, array length) emi...

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

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:934009f2-c1e4-e43c-3f4d-cf4b8c3643cb
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA31E:4BB79:933658:BD5E0F:6B00EF83
html-safe-nonce0bf613f444d4a6efe4470e67f58556a1209c04843f8498d7a70e204458ae81bd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzFFOjRCQjc5OjkzMzY1ODpCRDVFMEY6NkIwMEVGODMiLCJ2aXNpdG9yX2lkIjoiMzQ4NzE4MTE1NzQxMjQzMzc5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac84edf7f073e5b983dff3a62a33a9f777278032e907f097aec206e309e7f4000f
hovercard-subject-tagpull_request:4044207110
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/263/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 #184. The case decision-tree compiler already pruned redundant constructor-tag tests through MatchHistory, but every literal pattern (integer, float, string, char, boolean, array length) emi...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/purescript-lua/purescript-lua/pull/263/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F263%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%2F263%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/263/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/263/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/263/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-184/case-history-pruninghttps://github.com/purescript-lua/purescript-lua/tree/issue-184/case-history-pruning
Conversation 1 https://github.com/purescript-lua/purescript-lua/pull/263
Commits 2 https://github.com/purescript-lua/purescript-lua/pull/263/commits
Checks 2 https://github.com/purescript-lua/purescript-lua/pull/263/checks
Files changed https://github.com/purescript-lua/purescript-lua/pull/263/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/263/files
feat(ir): accumulate match history, prune literal retests https://github.com/purescript-lua/purescript-lua/pull/263/files#top
Show all changes 2 commits https://github.com/purescript-lua/purescript-lua/pull/263/files
784cda5 test(golden): pin the case decision trees before history pruning (#184) Unisay Jul 13, 2026 https://github.com/purescript-lua/purescript-lua/pull/263/commits/784cda560d9c15316896cfc78e98865573332124
e53b2de feat(ir): accumulate match history, prune literal retests (#184) Unisay Jul 13, 2026 https://github.com/purescript-lua/purescript-lua/pull/263/commits/e53b2defe01b5500579b8eff79bc340a730c20e4
Clear filters https://github.com/purescript-lua/purescript-lua/pull/263/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/263/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/263/files
20260713_134500_unisay_case_history_pruning.md https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-99c9e5345006662a3a89815f3679f4114e42b6d53cbbff32a53d7026e62e8377
IR.hs https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
Spec.hs https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
corefn.json https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-cfae48dbb4b8d57cca7ba84cc3e6ddbd437011cd182e88984ae1a0f02663e815
.gitignore https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-fee961cb32e53f10305981db7adccfc1cfc0d0c8131819d9e009ebb0b4215e44
golden.txt https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-48f65a94febc498305bca15244727539d38ac141313a4cd2e69cfc495af14240
golden.ir https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-90b270fb0c575ad63be2d3a34d6f490c96c8f6b0536069fb79a97c918d69da98
golden.lua https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-3dbcfad1e19a11d68f5041cfd1b9d50c09eacb7a6255757ee2f716b8fb1d8e0c
golden.ir https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-292d81d21168ba8db5d6e163376f12c847cda007c899fd67cb791b58ef93163a
golden.lua https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-89c0f94e087c8638afaac784a4bd8adf58db170c18babcb4d8c57a40ad0c000b
golden.ir https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-034a4e8cf0ebcaeed0750d6aec7c98fdf72b42eefddfd6ecb9eeef3a8872c2d9
golden.lua https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-579dad171afe8a5e04a0ebb3ca706532b1f14c969e19f9c2550ecd29b5ab7dad
golden.ir https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-df535e1f7273af0cc86db20df55495de4552000d7bf2f3abb21f421d07947914
golden.lua https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-8f846c962c84e2efb0046e7848c15b3bac3e044be37a2d2ee0620f823f2e9b0f
Test.purs https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-0b5fad8cbe283bd44df55c0a4b39a4a7c476fd3ae23026f95b4387f8ae4b807a
changelog.d/20260713_134500_unisay_case_history_pruning.mdhttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-99c9e5345006662a3a89815f3679f4114e42b6d53cbbff32a53d7026e62e8377
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/changelog.d/20260713_134500_unisay_case_history_pruning.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/263/{{ revealButtonHref }}
lib/Language/PureScript/Backend/IR.hshttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/lib/Language/PureScript/Backend/IR.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/263/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-b2e6467526a4a74dfd4d619dae7237fb05d5ad4386d4f8a893d4f82b4c31cd39
test/Language/PureScript/Backend/IR/Spec.hshttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/test/Language/PureScript/Backend/IR/Spec.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/263/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
https://github.com/purescript-lua/purescript-lua/pull/263/files#diff-edf87e4278f1d402b5fa79b30b8cc39979fe6db9af8cd7afaa5c09dadced0e4e
test/ps/output/Golden.CasePruning.Test/corefn.jsonhttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-cfae48dbb4b8d57cca7ba84cc3e6ddbd437011cd182e88984ae1a0f02663e815
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/test/ps/output/Golden.CasePruning.Test/corefn.json
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/263/files
test/ps/output/Golden.CasePruning.Test/eval/.gitignorehttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-fee961cb32e53f10305981db7adccfc1cfc0d0c8131819d9e009ebb0b4215e44
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/test/ps/output/Golden.CasePruning.Test/eval/.gitignore
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/263/{{ revealButtonHref }}
test/ps/output/Golden.CasePruning.Test/eval/golden.txthttps://github.com/purescript-lua/purescript-lua/pull/263/files#diff-48f65a94febc498305bca15244727539d38ac141313a4cd2e69cfc495af14240
View file https://github.com/purescript-lua/purescript-lua/blob/e53b2defe01b5500579b8eff79bc340a730c20e4/test/ps/output/Golden.CasePruning.Test/eval/golden.txt
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/263/{{ revealButtonHref }}
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/263/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.