diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1c6afb9..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "extends": "eslint:recommended", - "rules": { - "strict": [2, "global"], - "block-scoped-var": 2, - "consistent-return": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "no-caller": 2, - "no-extend-native": 2, - "no-loop-func": 2, - "no-new": 2, - "no-param-reassign": 2, - "no-return-assign": 2, - "no-unused-expressions": 2, - "no-use-before-define": 2, - "radix": [2, "always"], - "indent": [2, 2], - "quotes": [2, "double"], - "semi": [2, "always"] - } -} diff --git a/.gitignore b/.gitignore index b846b63..db67e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ /.* !/.gitignore -!/.eslintrc.json !/.github/ -/bower_components/ -/node_modules/ /output/ -package-lock.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..11ae766 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,45 @@ +# AGENTS.md + +A PureScript→Lua FFI fork in the [`purescript-lua`](https://github.com/Unisay/purescript-lua) package set. Generated code targets **Lua 5.1**. + +## Commands + +All commands run inside the nix dev shell: + +- Build: `nix develop -c ./scripts/build` +- Test (only if the fork has `scripts/test`): `nix develop -c bash ./scripts/test` +- Lint: `nix develop -c luacheck --quiet --std lua51 --no-unused-args src/` + +## Lua 5.1 target + +The output runs on Lua 5.1, which is stricter than 5.3: + +- No `table.unpack`, `bit32`, `utf8`, or the `//` operator. `math.pow` and `math.atan2` do exist. +- Array-style tables are 1-indexed: the first element is `t[1]`, not `t[0]`. +- `unit` is `{}`, never `nil`: a `nil` table element silently disappears, which would collapse `Array Unit` into an empty table. +- Lua 5.1 mangles some Lua 5.3 string escapes, so keep FFI string escapes 5.1-safe. + +## FFI files (under `src/`) + +pslua's foreign-file parser needs every exported value wrapped in parentheses: + +```lua +return { + identity = (function(x) return x end), + answer = (42), +} +``` + +A bare `function … end` or an unparenthesised expression fails to parse. + +## Toolchain + +`flake.nix` pins everything through [`purescript-overlay`](https://github.com/thomashoneyman/purescript-overlay): purs 0.15.16 (`purs-bin.purs-0_15_16`), spago 0.21.0 (`spago-bin.spago-0_21_0`), Lua 5.1 (`lua51Packages`). The `pslua` input tracks `github:Unisay/purescript-lua`; keep `flake.lock` reasonably current, since a long-stale pslua pin won't create the `--lua-output-file` directory and CI fails. + +## Releasing + +Tag-driven, with no GitHub Release or changelog entry. The full conventions live in the [package-set repo](https://github.com/Unisay/purescript-lua-package-sets/blob/master/CONTRIBUTING.md): push an annotated tag on `master`, bump this fork's `version` in the package set's `src/packages.dhall`, refresh `latest-compatible-sets.json`, and push a `psc-*` set tag. + +## Decisions + +Cross-cutting decisions are recorded as ADRs in the [package-set repo](https://github.com/Unisay/purescript-lua-package-sets/tree/master/docs/adr). Read them before a decision that affects the set, and add one after making such a decision. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/bower.json b/bower.json deleted file mode 100644 index d2783a8..0000000 --- a/bower.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "purescript-integers", - "homepage": "https://github.com/purescript/purescript-integers", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-integers.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-maybe": "^6.0.0", - "purescript-numbers": "^9.0.0", - "purescript-prelude": "^6.0.0" - }, - "devDependencies": { - "purescript-assert": "^6.0.0", - "purescript-console": "^6.0.0", - "purescript-partial": "^4.0.0" - } -} diff --git a/flake.lock b/flake.lock index 4dc7fae..4374d41 100644 --- a/flake.lock +++ b/flake.lock @@ -701,11 +701,11 @@ ] }, "locked": { - "lastModified": 1781426854, - "narHash": "sha256-TrqJ5GNiscEbQdx5O2ipuC8VFTlmxWLjOi34eMSIbb4=", + "lastModified": 1781449244, + "narHash": "sha256-evfLWZ+i55b0cSfd/jgU5mXuBg2KDEP5WhEj2iuzIiM=", "owner": "Unisay", "repo": "purescript-lua", - "rev": "c1b9dd0f2ecfe89c5523b8385a12caa5459bc133", + "rev": "94c13cecd1146494de56196a7badb3b1374d364d", "type": "github" }, "original": { diff --git a/package.json b/package.json deleted file mode 100644 index a1d6811..0000000 --- a/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "private": true, - "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "eslint src && pulp build -- --censor-lib --strict", - "test": "pulp test" - }, - "devDependencies": { - "eslint": "^7.15.0", - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" - } -}