{{ message }}
feat: bring st to the canon and add ST unit tests#1
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes purescript-lua-st to match the purescript-lua package-set “canon” (Nix flake + Spago + pslua backend) and introduces a runnable Lua 5.1 unit test suite for core ST/STRef behavior.
Changes:
- Replace legacy JS-era tooling (npm/bower/eslint/pulp + JS FFI remnants) with a Nix flake dev shell and hardened GitHub Actions CI.
- Add a Spago test config and shell test runner that builds
test/Main.purstodist/test.luaand runs it under Lua 5.1. - Update package metadata/docs (Spago deps, package-set URL, README, contributor/agent docs).
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
46a98de to
d970e93
Compare
Migrate purescript-lua-st off the JavaScript-era tooling onto the package-set canon: an overlay flake (purs 0.15.16, spago 0.21.0, Lua 5.1, pslua at the current main), hardened CI, scripts/build, AGENTS.md and CLAUDE.md, a clean .gitignore, and the org package-set URL. Drop the .eslintrc, package.json and the JavaScript FFI files. Add a systematic test suite: spago-test.dhall compiles test/Main.purs to dist/test.lua through pslua and scripts/test runs it under Lua 5.1. It covers STRef new/read/write/modify/modify', ST.run recursion, ST.for (hi-exclusive, lo-inclusive, empty range), ST.while and ST.foreach. Fixes surfaced by the new tests and luacheck: ST.for looped over an inclusive upper bound (for i = lo, hi) though the contract is hi-exclusive, so it ran one extra iteration -- corrected to hi - 1. Declare the effect dependency that Control.Monad.ST.Global needs, and wrap an over-long line in the Uncurried FFI so luacheck passes.
d970e93 to
1e40a04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Brings
purescript-lua-stonto the package-set canon and gives it a working Lua test suite.Scaffolding. Replaces the JavaScript-era tooling (npm/bower CI, easy-purescript flake,
.eslintrc,package.json,.jsFFI) with the canon: an overlay flake pinning purs 0.15.16 / spago 0.21.0 / Lua 5.1 andpsluaat the current main, hardened CI,scripts/build,AGENTS.md+CLAUDE.md, a clean.gitignore, and thepurescript-luaorg package-set URL.Tests.
spago-test.dhallcompilestest/Main.purstodist/test.luathrough pslua;scripts/testruns it under Lua 5.1. The suite assertsST.runwithSTRefnew/read/write/modify (sum of squares, write-then-read, modify-returns-new).Fixes found along the way.
Control.Monad.ST.GlobalimportsEffect, soeffectis now a declared dependency; and onemkSTFn10line in the Uncurried FFI was over 120 cols, so it is wrapped to keepluacheck --std lua51clean.Verified locally: build,
scripts/test(all ST tests passed), andluacheckall green.