René's URL Explorer Experiment


Title: ordBooleanImpl aliases unsafeCoerceImpl: compare on Boolean crashes under Lua 5.1 · Issue #10 · purescript-lua/purescript-lua-prelude · GitHub

Open Graph Title: ordBooleanImpl aliases unsafeCoerceImpl: compare on Boolean crashes under Lua 5.1 · Issue #10 · purescript-lua/purescript-lua-prelude

X Title: ordBooleanImpl aliases unsafeCoerceImpl: compare on Boolean crashes under Lua 5.1 · Issue #10 · purescript-lua/purescript-lua-prelude

Description: src/Data/Ord.lua defines a single comparison helper and reuses it for every type: local unsafeCoerceImpl = function(lt) return function(eq) return function(gt) return function(x) return function(y) if x < y then return lt elseif x == y t...

Open Graph Description: src/Data/Ord.lua defines a single comparison helper and reuses it for every type: local unsafeCoerceImpl = function(lt) return function(eq) return function(gt) return function(x) return function(y)...

X Description: src/Data/Ord.lua defines a single comparison helper and reuses it for every type: local unsafeCoerceImpl = function(lt) return function(eq) return function(gt) return function(x) return function(y)...

Opengraph URL: https://github.com/purescript-lua/purescript-lua-prelude/issues/10

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ordBooleanImpl aliases unsafeCoerceImpl: compare on Boolean crashes under Lua 5.1","articleBody":"\n`src/Data/Ord.lua` defines a single comparison helper and reuses it for every type:\n\n```lua\nlocal unsafeCoerceImpl = function(lt)\n  return function(eq)\n    return function(gt)\n      return function(x)\n        return function(y)\n          if x \u003c y then\n            return lt\n          elseif x == y then\n            return eq\n          else\n            return gt\n          end\n        end\n      end\n    end\n  end\nend\n\nreturn {\n  ordBooleanImpl = (unsafeCoerceImpl),\n  ...\n}\n```\n\nFor Int, Number, String and Char the `\u003c` operator is well defined in Lua, so reusing the helper is fine. For Boolean it is not. Lua 5.1 (the pslua target) raises a runtime error on relational operators between booleans:\n\n```\n$ lua -e 'print(pcall(function() return false \u003c true end))'\nfalse\t(command line):1: attempt to compare two boolean values\n```\n\nSo any use of `Ord Boolean` (`compare`, `\u003c`, `\u003c=`, `min`, `max`, `clamp`) crashes at runtime instead of returning an ordering. The bug stays silent until a program actually compares two booleans.\n\n## Fix\n\nGive `ordBooleanImpl` its own implementation that orders `false \u003c true` without relying on `\u003c`:\n\n```lua\nordBooleanImpl = (function(lt)\n  return function(eq)\n    return function(gt)\n      return function(x)\n        return function(y)\n          if not x and y then\n            return lt\n          elseif x == y then\n            return eq\n          else\n            return gt\n          end\n        end\n      end\n    end\n  end\nend),\n```\n\nA working implementation already exists in @UnrelatedString's #3. It will be carried over from there with credit as part of the upstream-sync pass. The other `ord*Impl` aliases are correct and should stay on the shared helper.\n\n## Test coverage\n\nThe fix must ship with a regression test that fails on the current alias and passes after the fix: assert `compare false true == LT`, `compare true false == GT`, `compare true true == EQ`, and that `min`/`max` on Boolean do not error. This belongs in the prelude test suite being revived during upstream-sync. Without it the crash can regress unnoticed, since luacheck does not exercise the comparison.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-06-14T11:11:13Z","url":"https://github.com/purescript-lua/purescript-lua-prelude/issues/10"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:90435bec-28d9-3e59-9308-b63027b55858
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC8EE:213839:F8F5F5:140E46F:6B01009F
html-safe-nonceb4d438f4f3467dd360c6a3be34e89e18f1bc2322fe9b2f50b95d92ef3194e670
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEVFOjIxMzgzOTpGOEY1RjU6MTQwRTQ2Rjo2QjAxMDA5RiIsInZpc2l0b3JfaWQiOiI1OTczODg4NzI2OTc0MTM2NDc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacae4450fd045f2efc9261fd842699b67dae576f6dc78d1b20a3d484e71db21844
hovercard-subject-tagissue:4658876503
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua-prelude/10/issue_layout
twitter:imagehttps://opengraph.githubassets.com/afd18c95e77ba3ffcec550dd3b1495924c226df9862f77ca215f23cca40f906c/purescript-lua/purescript-lua-prelude/issues/10
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/afd18c95e77ba3ffcec550dd3b1495924c226df9862f77ca215f23cca40f906c/purescript-lua/purescript-lua-prelude/issues/10
og:image:altsrc/Data/Ord.lua defines a single comparison helper and reuses it for every type: local unsafeCoerceImpl = function(lt) return function(eq) return function(gt) return function(x) return function(y)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameUnisay
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
go-importgithub.com/purescript-lua/purescript-lua-prelude git https://github.com/purescript-lua/purescript-lua-prelude.git
octolytics-dimension-user_id131581790
octolytics-dimension-user_loginpurescript-lua
octolytics-dimension-repository_id620956647
octolytics-dimension-repository_nwopurescript-lua/purescript-lua-prelude
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id33838632
octolytics-dimension-repository_parent_nwopurescript/purescript-prelude
octolytics-dimension-repository_network_root_id33838632
octolytics-dimension-repository_network_root_nwopurescript/purescript-prelude
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/purescript-lua/purescript-lua-prelude/issues/10#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua-prelude%2Fissues%2F10
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-prelude%2Fissues%2F10
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=purescript-lua%2Fpurescript-lua-prelude
Reloadhttps://github.com/purescript-lua/purescript-lua-prelude/issues/10
Reloadhttps://github.com/purescript-lua/purescript-lua-prelude/issues/10
Reloadhttps://github.com/purescript-lua/purescript-lua-prelude/issues/10
purescript-luahttps://github.com/purescript-lua
purescript-lua-preludehttps://github.com/purescript-lua/purescript-lua-prelude
Codehttps://github.com/purescript-lua/purescript-lua-prelude
Issues1 (1)https://github.com/purescript-lua/purescript-lua-prelude/issues
Pull requestshttps://github.com/purescript-lua/purescript-lua-prelude/pulls
Actionshttps://github.com/purescript-lua/purescript-lua-prelude/actions
Security and qualityhttps://github.com/purescript-lua/purescript-lua-prelude/security
Insightshttps://github.com/purescript-lua/purescript-lua-prelude/insights
https://github.com/purescript-lua/purescript-lua-prelude
New issuehttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua-prelude/issues/10
New issuehttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua-prelude/issues/10
ordBooleanImpl aliases unsafeCoerceImpl: compare on Boolean crashes under Lua 5.1https://github.com/purescript-lua/purescript-lua-prelude/issues/10#top
https://github.com/Unisay
https://github.com/Unisay
Unisayhttps://github.com/Unisay
on Jun 14, 2026https://github.com/purescript-lua/purescript-lua-prelude/issues/10#issue-4658876503
@UnrelatedStringhttps://github.com/UnrelatedString
#3https://github.com/purescript-lua/purescript-lua-prelude/pull/3
Unisayhttps://github.com/Unisay
on Jun 14, 2026https://github.com/purescript-lua/purescript-lua-prelude/issues/10#event-26724332722
https://github.com/Unisay
Unisayhttps://github.com/Unisay
on Jun 15, 2026https://github.com/purescript-lua/purescript-lua-prelude/issues/10#issuecomment-4707217456
Unisayhttps://github.com/Unisay
completedhttps://github.com/purescript-lua/purescript-lua-prelude/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 15, 2026https://github.com/purescript-lua/purescript-lua-prelude/issues/10#event-26753383041
Sign up for freehttps://github.com/signup?return_to=https://github.com/purescript-lua/purescript-lua-prelude/issues/10
Sign in to commenthttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua-prelude/issues/10
Unisayhttps://github.com/Unisay
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.