René's URL Explorer Experiment


Title: feat(optimizer): fold ordering on ASCII char literals (#222) by Unisay · Pull Request #288 · purescript-lua/purescript-lua · GitHub

Open Graph Title: feat(optimizer): fold ordering on ASCII char literals (#222) by Unisay · Pull Request #288 · purescript-lua/purescript-lua

X Title: feat(optimizer): fold ordering on ASCII char literals (#222) by Unisay · Pull Request #288 · purescript-lua/purescript-lua

Description: Closes #222. What compareLiterals (né numericCompare, renamed since it now handles more than numbers) gains one arm: ordering comparisons (<, <=, >, >=) on two Char literals fold at compile time when both codepoints are below U+0080. (LiteralChar _ x, LiteralChar _ y) | isAscii x, isAscii y → Just (compare x y) Why the ASCII gate Note [Folding primops follows Lua 5.1] holds ordering back because Lua orders strings by bytes while the IR literal carries a semantic codepoint, so a host-side compare could disagree with the runtime on non-ASCII operands. For two ASCII chars the single-byte representation orders identically to the codepoint, so the fold matches the runtime exactly. Non-ASCII chars and String literals stay out of scope; the Note's comparison bullet is updated to record the refinement. Effect on the CharLiterals golden The final show ('\t' < '\n') used to compile to a runtime branch on a constant condition: return Effect_Console_log((function() local v_S_221 = "\t" < "\n" if v_S_221 then return "true" elseif false == v_S_221 then return "false" else return error("No patterns matched") end end)())() With the fold in place the existing downstream rewrites cascade (if true then LT else GT → LT, "…LT" == "…LT" → true, if true then "true" → "true") and the whole block collapses: return Effect_Console_log("true")() The hand-verified eval oracle (eval/golden.txt) is unchanged — the module still prints true — so the collapse is semantics-preserving. Tests Written test-first (red before the fix): a unit test pins the ASCII fold for all four operators, and a companion test pins the soundness guard — a non-ASCII pair ('é' < 'ê') and a mixed pair ('a' < 'é') are left unfolded. Full cabal test all is green, and the randomized IR Optimizer spec group was stress-run 12 times on fresh seeds with no failures or hangs.

Open Graph Description: Closes #222. What compareLiterals (né numericCompare, renamed since it now handles more than numbers) gains one arm: ordering comparisons (<, <=, >, >=) on two Char literals fold at com...

X Description: Closes #222. What compareLiterals (né numericCompare, renamed since it now handles more than numbers) gains one arm: ordering comparisons (&lt;, &lt;=, &gt;, &gt;=) on two Char lite...

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

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:335f900b-70c2-64a6-2f85-7779e5a1bd57
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA0BA:172B92:A88A14:E2D401:6B00EFA0
html-safe-nonce24e6668a02659e540a36f3df170f06818cd2f608740e47d8f7a4ac67917707a7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMEJBOjE3MkI5MjpBODhBMTQ6RTJENDAxOjZCMDBFRkEwIiwidmlzaXRvcl9pZCI6IjI3NzU0NTI5OTU2OTE4MDI1MjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac08165c0376f68acb6b73138fe2e1ba33a47e841eb0e5c1c2ace8466d0eaa133f
hovercard-subject-tagpull_request:4114802860
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/288/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 #222. What compareLiterals (né numericCompare, renamed since it now handles more than numbers) gains one arm: ordering comparisons (<, <=, >, >=) on two Char literals fold at com...
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/288/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F288%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%2F288%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/288/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/288/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/288/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-222/fold-ascii-char-orderinghttps://github.com/purescript-lua/purescript-lua/tree/issue-222/fold-ascii-char-ordering
Conversation 0 https://github.com/purescript-lua/purescript-lua/pull/288
Commits 1 https://github.com/purescript-lua/purescript-lua/pull/288/commits
Checks 2 https://github.com/purescript-lua/purescript-lua/pull/288/checks
Files changed https://github.com/purescript-lua/purescript-lua/pull/288/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/288/files
feat(optimizer): fold ordering on ASCII char literals (#222) https://github.com/purescript-lua/purescript-lua/pull/288/files#top
Show all changes 1 commit https://github.com/purescript-lua/purescript-lua/pull/288/files
c4cc4e2 feat(optimizer): fold ordering on ASCII char literals (#222) Unisay Jul 23, 2026 https://github.com/purescript-lua/purescript-lua/pull/288/commits/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3
Clear filters https://github.com/purescript-lua/purescript-lua/pull/288/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/288/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/288/files
20260723_100000_unisay_fold_ascii_char_ordering.md https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-c817906526e0cd21fb94d3440723251971c3d6851db0cea1d606a6bbb5a4569f
Optimizer.hs https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
Spec.hs https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
golden.ir https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-51768e0a180e8ba17b000ead8fa35bcd5743917951b324a2b821a2ffbfd4ee35
golden.lua https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-33101f4068d284cd068f09a25c752d3e6d8287f96ae0b55f30ffa86fa165fa8e
changelog.d/20260723_100000_unisay_fold_ascii_char_ordering.mdhttps://github.com/purescript-lua/purescript-lua/pull/288/files#diff-c817906526e0cd21fb94d3440723251971c3d6851db0cea1d606a6bbb5a4569f
View file https://github.com/purescript-lua/purescript-lua/blob/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3/changelog.d/20260723_100000_unisay_fold_ascii_char_ordering.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/288/{{ revealButtonHref }}
lib/Language/PureScript/Backend/IR/Optimizer.hshttps://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
View file https://github.com/purescript-lua/purescript-lua/blob/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3/lib/Language/PureScript/Backend/IR/Optimizer.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/288/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
test/Language/PureScript/Backend/IR/Optimizer/Spec.hshttps://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
View file https://github.com/purescript-lua/purescript-lua/blob/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3/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/288/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
test/ps/output/Golden.CharLiterals.Test/golden.irhttps://github.com/purescript-lua/purescript-lua/pull/288/files#diff-51768e0a180e8ba17b000ead8fa35bcd5743917951b324a2b821a2ffbfd4ee35
View file https://github.com/purescript-lua/purescript-lua/blob/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3/test/ps/output/Golden.CharLiterals.Test/golden.ir
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/288/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-51768e0a180e8ba17b000ead8fa35bcd5743917951b324a2b821a2ffbfd4ee35
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-51768e0a180e8ba17b000ead8fa35bcd5743917951b324a2b821a2ffbfd4ee35
test/ps/output/Golden.CharLiterals.Test/golden.luahttps://github.com/purescript-lua/purescript-lua/pull/288/files#diff-33101f4068d284cd068f09a25c752d3e6d8287f96ae0b55f30ffa86fa165fa8e
View file https://github.com/purescript-lua/purescript-lua/blob/c4cc4e280a3ad9d2f9bd39fc2ee6c21da3a918f3/test/ps/output/Golden.CharLiterals.Test/golden.lua
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/288/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/288/files#diff-33101f4068d284cd068f09a25c752d3e6d8287f96ae0b55f30ffa86fa165fa8e
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.