haskell: Phase 7 conformance — runlength-str.hs + ++ thunk-tail fix (+9 tests, 9/9)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 21:45:23 +00:00
parent f6efba410a
commit 685fcd11d5
4 changed files with 106 additions and 8 deletions

View File

@@ -89,7 +89,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
- [x] Tests in `lib/haskell/tests/string-char.sx` (≥ 15 tests: head/tail on
string literal, map over string, filter chars, chr/ord roundtrip, toUpper,
toLower, null/empty string view).
- [ ] Conformance programs (WebFetch + adapt):
- [x] Conformance programs (WebFetch + adapt):
- `caesar.hs` — Caesar cipher. Exercises `map`, `chr`, `ord`, `toUpper`,
`toLower` on characters.
- `runlength-str.hs` — run-length encoding on a String. Exercises string
@@ -284,6 +284,19 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-06** — Phase 7 conformance complete (runlength-str.hs) + `++` thunk fix:
- New `lib/haskell/tests/program-runlength-str.sx` (9 tests). Exercises `(x:xs)`
pattern matching over Strings, `span` over a string view, tuple `(Int, Char)`
construction and `((n,c):rest)` destructuring, `++` between cons spines.
- `runlength-str` added to `PROGRAMS` in `conformance.sh`.
- `eval.sx`: `hk-list-append` now `(hk-force a)` on entry. Pre-existing latent
bug — when a cons's tail was a thunk (e.g. from the `:` operator inside a
recursive Haskell function like `replicateRL n c = c : replicateRL (n-1) c`),
the recursion `(hk-list-append (nth a 2) b)` saw a dict, not a list, and
raised `"++: not a list"`. Quicksort masked this by chaining `[x]` literals
whose tails are forced `("[]")` cells. Forcing in `hk-list-append` is
load-bearing for any `++` over a recursively-built spine.
**2026-05-06** — Phase 7 conformance (caesar.hs):
- New `lib/haskell/tests/program-caesar.sx` (8 tests). Caesar cipher exercising
`chr`, `ord`, `isUpper`, `isLower`, `mod`, `map`, and `(x:xs)` pattern matching