Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d0846d1
Update LICENSE
UnrelatedString Mar 25, 2025
61f1383
Update ci.yml just the way I like it :3
UnrelatedString Mar 25, 2025
b4a2958
...let's start by using my usual CI action for Spago on Node...
UnrelatedString Mar 25, 2025
f83422e
…except with legacy Spago because I feel like porting to Next is out …
UnrelatedString Mar 25, 2025
968a2e9
Already beginning to regret sticking with legacy Spago :/
UnrelatedString Mar 25, 2025
5ab5bbb
Update spago.dhall because of course the test directory just DIDN’T E…
UnrelatedString Mar 26, 2025
943fabe
Update README.md
UnrelatedString Mar 26, 2025
edc3f31
step 1: actually make it install the Lua interpreter
UnrelatedString Mar 26, 2025
84108fd
UH OH
UnrelatedString Mar 26, 2025
bc1b010
WHATTTTTT DO YOU MEAN INVALID ARGUMENT
UnrelatedString Mar 26, 2025
38eb528
oh it's just because I don't have a main LMAOOO
UnrelatedString Mar 26, 2025
a6988ab
ooooh yeah this is progress now :D
UnrelatedString Mar 26, 2025
211f004
cleaner failure for my ./spago-legacy lmao
UnrelatedString Mar 26, 2025
be89834
committing my first attempt at writing any Lua ever before testing it…
UnrelatedString Mar 26, 2025
d7bc0a5
easy fixes! now it just. stack overflows uhhhhh
UnrelatedString Mar 26, 2025
422b26e
okay so this is deeply worrying BUT it's evidently a problem with the…
UnrelatedString Mar 26, 2025
6891f38
Merge branch 'lua-tests' into lua-ci
UnrelatedString Mar 26, 2025
d58f5ff
nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
UnrelatedString Mar 26, 2025
714faf0
make it less confusing :p
UnrelatedString Mar 26, 2025
a4fab27
Merge branch 'lua-ci' of https://github.com/UnrelatedString/purescrip…
UnrelatedString Mar 26, 2025
1887ba4
feel stupid actually committing this scratch work but I'll forget thi…
UnrelatedString Mar 26, 2025
5e1e3ea
and just in case dead code elimination :P
UnrelatedString Mar 26, 2025
dad261f
also WHAT HAPPENED TO THE NIX BUILD IN THE CI aaaaaaa ;_; what kind o…
UnrelatedString Mar 26, 2025
862e075
Update ci.yml because oh. the build got TIMED OUT
UnrelatedString Mar 26, 2025
b7c1fae
://///////////
UnrelatedString Mar 26, 2025
77ce4a6
Update ci.yml
UnrelatedString Mar 26, 2025
81c8600
Update ci.ymlllllll
UnrelatedString Mar 26, 2025
5eee102
Update ci.yml
UnrelatedString Mar 26, 2025
4665847
Update ci.yml because oh yeahhhh
UnrelatedString Mar 26, 2025
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
44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: CI

on:
push:
branches: [master]
pull_request:
on: [push]

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"
- name: Install Lua interpreter
uses: leafo/gh-actions-lua@v11

- uses: actions/setup-node@v2
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: "14.x"
node-version: "20.x"

- name: Install dependencies
- name: Set up Purescript and spago-legacy
run: |
npm install -g bower
npm install
bower install --production
npm i -g purescript
npm i -g spago-legacy

- name: Build source
run: npm run-script build
- name: Download pslua
run: wget -c https://github.com/Unisay/purescript-lua/releases/download/0.2/pslua-linux_x86_64.tar.gz -O - | tar -xz

- name: Run tests
run: |
bower install
npm run-script test --if-present
- run: mkdir bin
- run: mv pslua bin

- name: Put pslua on PATH
run: realpath bin >> $GITHUB_PATH

- name: Build and test
run: ./test.sh
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 PureScript
Copyright 2018-2025 PureScript, Unisay, UnrelatedString

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# purescript-prelude
# purescript-lua-prelude

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

The PureScript prelude.
The PureScript prelude for Lua.


## Installation

Expand All @@ -14,4 +15,4 @@ spago install prelude

## Documentation

Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-prelude).
Module documentation (for the implementation of the same API for the JavaScript backend) is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-prelude).
6 changes: 6 additions & 0 deletions spago-legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
if spago-legacy --version > /dev/null; then
spago-legacy "$@"
else
spago "$@"
fi
3 changes: 2 additions & 1 deletion spago.dhall
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ name = "purescript-lua-prelude"
, dependencies = [ ] : List Text
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
, backend = "pslua --foreign-path . --lua-output-file output/main.lua"
}
9 changes: 9 additions & 0 deletions test.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let normal = ./spago.dhall
in normal //
{ backend = ''
pslua \
--foreign-path . \
--lua-output-file output/test.lua \
--entry Test.Main
''
}
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
./spago-legacy -x test.dhall build && lua output/test.lua && echo Tests passed!
39 changes: 39 additions & 0 deletions test/Test/Main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
return {
testNumberShow = (function(showNumber)
return function()
cases = {
{0.0, "0.0"},
{1.0, "1.0"},
{-1.0, "-1.0"},
{500.0, "500.0"},

-- Outside Int range
{1e10, "10000000000.0"},
{1e10 + 0.5, "10000000000.5"},
{-1e10, "-10000000000.0"},
{-1e10 - 0.5, "-10000000000.5"},

-- With exponent
{1e21, "1e+21"},
{1e-21, "1e-21"},

-- With decimal and exponent
{1.5e21, "1.5e+21"},
{1.5e-10, "1.5e-10"},

{nan, "NaN"},
{math.huge, "Infinity"},
{-math.huge, "-Infinity"},
}

for case in cases do
input = case[0]
expected = case[1]
actual = showNumber(input)
if expected ~= actual then
error("For "..input..", expected "..expected..", got: "..actual..".")
end
end
end
end)
}
4 changes: 2 additions & 2 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Data.Ord (abs, signum)
import Data.Reflectable (reflectType, reifyType)
import Prim.Boolean (True, False)
import Prim.Ordering (LT, GT, EQ)
import Test.Data.Generic.Rep (testGenericRep)
--import Test.Data.Generic.Rep (testGenericRep)
import Test.Utils (AlmostEff, assert)
import Type.Proxy (Proxy(..))

Expand All @@ -18,7 +18,7 @@ main = do
testIntDivMod
testIntDegree
testRecordInstances
testGenericRep
--testGenericRep
testReflectType
testReifyType
testSignum
Expand Down
7 changes: 7 additions & 0 deletions test/Test/Utils.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
throwErr = (function(msg)
return function()
error(msg)
end
end),
}