Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: purescript/purescript-strings
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: purescript-lua/purescript-lua-strings
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 19 commits
  • 44 files changed
  • 3 contributors

Commits on Mar 31, 2024

  1. Configuration menu
    Copy the full SHA
    d6ff26a View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2026

  1. chore: repair the test build

    The repo never had the spago-test.dhall that scripts/test refers to,
    and the package set pins (psc-0.15.15-2024*) predate prelude v7.2.0
    (unit = {}) and the assert override. Bump the sets, define the test
    build on top of spago.dhall, and drop the Regex test wiring: the fork
    has no Data.String.Regex implementation (tracked separately).
    
    The flake inputs were two years stale as well: the pinned pslua
    predates several codegen fixes; nixpkgs/easyps now match the pins of
    the main pslua repo (purs-tidy is dropped from the shell - it does not
    evaluate against the current nixpkgs and nothing in this repo uses it).
    
    The prelude package is temporarily overridden with a local clone until
    the Lua 5.1 compat fixes land in a released package set.
    Unisay committed Jun 12, 2026
    Configuration menu
    Copy the full SHA
    2edd0e6 View commit details
    Browse the repository at this point in the history
  2. test: split each suite into per-section functions

    A single do-block with a hundred statements compiles to Lua nested
    beyond the parser limit of stock Lua 5.1 interpreters ("chunk has too
    many syntax levels", purescript-lua/purescript-lua#46). One function per log
    section keeps the nesting flat. Assertions are unchanged except two
    byte-semantics adaptations in NonEmpty.CodeUnits: charAt over "5 €"
    yields the first UTF-8 byte of the euro sign, and the toCharArray case
    uses an ASCII string because a multi-byte Char literal is not
    expressible when Char is a byte.
    Unisay committed Jun 12, 2026
    Configuration menu
    Copy the full SHA
    12679df View commit details
    Browse the repository at this point in the history
  3. feat: implement Data.String.CodePoints for UTF-8 strings

    Closes purescript-lua/purescript-lua#36.
    
    In pslua a String is a Lua byte string holding UTF-8, so all seven
    foreign functions decode/encode UTF-8 directly with plain Lua 5.1
    arithmetic (no utf8 library, no bitops). The PureScript fallback
    arguments are UTF-16 surrogate-pair logic and are ignored: under the
    byte representation they would produce garbage.
    
    The pure uncons carried the same surrogate logic (charAt 0/1 yields
    bytes here, never in the surrogate range, so it silently returned the
    first byte as a code point); its tail now starts after the UTF-8 width
    of the head.
    
    The test suite replaces the upstream lone-surrogate string (not
    representable in UTF-8) with well-formed Unicode of widths 1-4 and
    keeps its structure; lone-surrogate-specific probes are dropped and
    toCodePointArray/fromCodePointArray roundtrips are added.
    Unisay committed Jun 12, 2026
    Configuration menu
    Copy the full SHA
    644ae9f View commit details
    Browse the repository at this point in the history
  4. fix: 0-based indices and literal patterns in CodeUnits and Common

    CodeUnits returned 1-based Lua positions where PureScript expects
    0-based indices (charAt answered Nothing for index 0, indexOf was off
    by one, lastIndexOf also ignored the pattern width), and take/slice/
    splitAt passed negative indices straight to string.sub, which counts
    from the end instead of clamping. Index handling now mirrors the
    upstream JS (indexOf guard, lastIndexOf clamp, slice wrapping).
    
    Common.replace/replaceAll/split treated Pattern as a Lua pattern and
    even applied gsub to the Replacement; PureScript semantics are literal
    matching, so the rewrite uses string.find in plain mode. replaceAll
    also no longer leaks gsub's second return value, and split keeps
    empty fields and multi-character separators.
    Unisay committed Jun 12, 2026
    Configuration menu
    Copy the full SHA
    f49e9dc View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2026

  1. fix: byte-accurate uncons tail; cover decode/encode edges

    Review follow-up on #1.
    
    uncons recomputed the tail offset from the head code point value
    (utf8Width), but the decoder consumes a single byte for a malformed
    leading byte (a lone continuation or a truncated multi-byte lead).
    For those inputs the width disagreed with what was actually read and
    uncons skipped extra bytes, desynchronising the rest of the string.
    The tail is now `drop 1`, which is defined via the same native decoder
    that produces the head, so the two can never disagree; utf8Width is
    gone.
    
    Add direct coverage of the encoder/decoder: round-trips at every UTF-8
    width boundary (0x7F/0x80, 0x7FF/0x800, 0xFFFF/0x10000, 0x10FFFF) and
    malformed input (lone continuation byte between ASCII anchors, and
    truncated two- and three-byte leads), where the raw bytes are built
    with CodeUnits.singleton since a string literal would be re-encoded as
    valid UTF-8.
    Unisay committed Jun 13, 2026
    Configuration menu
    Copy the full SHA
    9cd49b8 View commit details
    Browse the repository at this point in the history
  2. chore: build against the released set; nix CI; fix uncons binding cycle

    Switch packages.dhall from the local prelude override to the released
    package set (psc-0.15.15-20260613, which carries prelude v7.2.1), so a
    fresh clone and CI can build without a sibling checkout. Bump the flake
    pin of pslua to the merged Char-literal-escaping fix.
    
    Replace the inherited bower CI (no bower.json in this fork) with one
    that runs scripts/test and luacheck in the nix dev shell, and make
    scripts/test exit non-zero on failure so red tests fail CI.
    
    uncons now reaches take (via drop), closing a recursive group with the
    point-free `take = _take takeFallback`; eta-expand take so every member
    of the group is a function and purs accepts it.
    Unisay committed Jun 13, 2026
    Configuration menu
    Copy the full SHA
    056b535 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #1 from Unisay/issue/codepoints-ffi

    Implement Data.String.CodePoints, repair the test suite
    Unisay authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    395c4b6 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2026

  1. chore: normalize build tooling

    Replace the inherited bower CI (no bower.json in this fork) with a nix-based one that runs scripts/build, scripts/test (if present) and luacheck; make the scripts fail-fast; refresh stale flake inputs.
    Unisay committed Jun 14, 2026
    Configuration menu
    Copy the full SHA
    6d46b2d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e63561b View commit details
    Browse the repository at this point in the history
  3. Merge pull request #2 from Unisay/chore/normalize-tooling

    chore: normalize build tooling (nix CI, fail-fast scripts, fresh flake)
    Unisay authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    39f7ebb View commit details
    Browse the repository at this point in the history
  4. chore: align CI to hardened canon, add AGENTS.md + CLAUDE.md

    CI: drop accept-flake-config (supply-chain risk; caches already pinned),
    run luacheck with --std lua51 --no-unused-args (matches the Lua 5.1 target
    and the curried-FFI idiom), invoke the test step via bash so it no longer
    needs the execute bit.
    
    AGENTS.md is the single instruction file the coding agents read natively;
    CLAUDE.md is a one-line @AGENTS.md import so Claude Code shares it. Also
    removes dead JavaScript-era package files. Tooling and docs only, no src/.
    Unisay committed Jun 14, 2026
    Configuration menu
    Copy the full SHA
    bebcf0a View commit details
    Browse the repository at this point in the history
  5. Merge pull request #3 from Unisay/chore/agents-md-and-canon-ci

    chore: align CI to the hardened canon, add AGENTS.md
    Unisay authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    e55cf13 View commit details
    Browse the repository at this point in the history
  6. chore: point pslua + package-set links at purescript-lua org

    Repos moved from Unisay/* to the purescript-lua org. Update the pslua
    flake input and lockfile owner (same rev 94c13ce), the packages.dhall
    upstream-lua release URL, and the doc/comment links, so nothing relies
    on the old-owner redirect.
    Unisay committed Jun 14, 2026
    Configuration menu
    Copy the full SHA
    d6ceb3a View commit details
    Browse the repository at this point in the history
  7. Merge pull request #4 from purescript-lua/chore/migrate-org-links

    chore: point pslua + package-set links at purescript-lua org
    Unisay authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    3962837 View commit details
    Browse the repository at this point in the history
  8. chore: add treefmt formatting (nix fmt) and format the tree

    Wire treefmt via treefmt-nix: nixfmt, dhall format, purs-tidy (.tidyrc.json)
    and LuaFormatter for the FFI (.lua-format, kept over StyLua because it
    preserves the parentheses pslua's parser needs). `nix fmt` formats; the dev
    shell installs a content-based pre-commit hook and CI runs
    `nix fmt && git diff --exit-code` (content-based, since the in-place
    formatters bump mtime and would trip treefmt --fail-on-change). Lua lines
    budget 130 cols, matching the raised `luacheck --max-line-length`. The bulk
    of the diff is the first format pass.
    Unisay committed Jun 14, 2026
    Configuration menu
    Copy the full SHA
    b078fe6 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2026

  1. Merge pull request #5 from purescript-lua/chore/treefmt

    chore: add treefmt formatting (nix fmt + pre-commit + CI check)
    Unisay authored Jun 15, 2026
    Configuration menu
    Copy the full SHA
    10838df View commit details
    Browse the repository at this point in the history
  2. chore: harden pre-commit hook (tracked .githooks/ + core.hooksPath)

    Replace the dev-shell installer that wrote .git/hooks/pre-commit with a
    tracked .githooks/pre-commit wired via `git config core.hooksPath .githooks`.
    
    Fixes three issues with the old hook: it gated on `[ -d .git ]` (false in
    worktrees/submodules where .git is a file), it clobbered any existing
    .git/hooks/pre-commit on every `nix develop`, and `nix fmt … || exit 0`
    swallowed real formatter failures. The new hook skips only when `nix` is
    absent (CI is the authoritative gate) and otherwise blocks on a `nix fmt`
    failure or reformat.
    Unisay committed Jun 15, 2026
    Configuration menu
    Copy the full SHA
    ee679e7 View commit details
    Browse the repository at this point in the history
  3. chore: bump pslua dev input to 62e3653

    Toolchain consistency: pin the pslua dev flake input to the current
    compiler main across the ecosystem. flake.lock only; the package set
    consumes sources + FFI, not this dev input, so no re-tag is needed.
    Unisay committed Jun 15, 2026
    Configuration menu
    Copy the full SHA
    458a7ac View commit details
    Browse the repository at this point in the history
Loading