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
| File | Description |
|---|---|
test/Main.purs |
Adds unit tests for ST.run and STRef new/read/write/modify, plus a success log message. |
src/Control/Monad/ST/Uncurried.lua |
Wraps mkSTFn10 across lines to satisfy luacheck line-length constraints. |
src/Control/Monad/ST/Uncurried.js |
Removes JS backend FFI implementation for ST uncurried helpers. |
src/Control/Monad/ST/Internal.js |
Removes JS backend FFI implementation for core ST operations and STRef primitives. |
src/Control/Monad/ST/.editorconfig |
Removes per-subdir EditorConfig (tooling is centralized elsewhere). |
spago.dhall |
Adds effect dependency and updates pslua backend entry/output settings. |
spago-test.dhall |
Adds a test Spago config to compile Test.Main into dist/test.lua and include test deps. |
scripts/test |
Adds a CI-friendly test runner that builds via spago-test.dhall and runs Lua 5.1. |
scripts/build |
Hardens build script (set -euo pipefail) and uses plain spago build. |
README.md |
Updates project identity and positioning as the Lua fork, plus current CI/docs links. |
packages.dhall |
Points the Lua package-set URL at the purescript-lua org location. |
package.json |
Removes legacy npm/pulp/eslint tooling configuration. |
flake.nix |
Replaces easy-purescript tooling with purescript-overlay, pins toolchain, and adds nixConfig caches. |
flake.lock |
Updates lockfile to match the new flake inputs/toolchain. |
CLAUDE.md |
Adds a pointer to AGENTS.md for agent instructions. |
AGENTS.md |
Documents the Lua 5.1 target, FFI conventions, and canonical build/test/lint commands. |
.gitignore |
Cleans up ignores after removing node/bower-era artifacts. |
.github/workflows/ci.yml |
Replaces Node-based CI with Nix-based build/test/luacheck steps. |
.eslintrc.json |
Removes legacy ESLint configuration. |
💡 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.