Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .eslintrc.json

This file was deleted.

30 changes: 11 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,24 @@ on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"
- uses: actions/checkout@v4

- uses: actions/setup-node@v2
- uses: cachix/install-nix-action@v27
with:
node-version: "14.x"
extra_nix_config: |
extra-substituters = https://cache.iog.io https://purescript-lua.cachix.org
extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= purescript-lua.cachix.org-1:yLs4ei2HtnuPtzLekOrW3xdfm95+Etw15gwgyIGTayA=

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production
- name: Build
run: nix develop -c ./scripts/build

- name: Build source
run: npm run-script build
- name: Test
run: if [ -f scripts/test ]; then nix develop -c bash ./scripts/test; fi

- name: Run tests
run: |
bower install
npm run-script test --if-present
- name: Luacheck
run: nix develop -c luacheck --quiet --std lua51 --no-unused-args src/
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/.*
!/.gitignore
!/.eslintrc.json
!/.github/
/bower_components/
/node_modules/
/output/
package-lock.json
45 changes: 45 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# AGENTS.md

A PureScript→Lua FFI fork in the [`purescript-lua`](https://github.com/purescript-lua/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:purescript-lua/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/purescript-lua/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/purescript-lua/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.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# purescript-st
# purescript-lua-st

[![Latest release](http://img.shields.io/github/release/purescript/purescript-st.svg)](https://github.com/purescript/purescript-st/releases)
[![Build status](https://github.com/purescript/purescript-st/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-st/actions?query=workflow%3ACI+branch%3Amaster)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-st/badge)](https://pursuit.purescript.org/packages/purescript-st)
[![CI](https://github.com/purescript-lua/purescript-lua-st/actions/workflows/ci.yml/badge.svg)](https://github.com/purescript-lua/purescript-lua-st/actions/workflows/ci.yml)

The ST effect, for safe local mutation.
The ST effect, for safe local mutation. This is the Lua fork of
[`purescript-st`](https://github.com/purescript/purescript-st) for the
[pslua](https://github.com/purescript-lua/purescript-lua) compiler backend: it
keeps the upstream PureScript API and replaces the JavaScript FFI with Lua that
runs on Lua 5.1.

## Installation

It ships in the [purescript-lua package set](https://github.com/purescript-lua/purescript-lua-package-sets):

```
spago install st
```

## Documentation

Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-st).
The API matches upstream, so the module docs are
[published on Pursuit](https://pursuit.purescript.org/packages/purescript-st).
Loading
Loading