haskell: Phase 8 — tests/show.sx expanded to 26/26 (full audit coverage)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 57s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 01:04:52 +00:00
parent d8dec07df3
commit bb134b88e3
2 changed files with 98 additions and 5 deletions

View File

@@ -110,9 +110,11 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
- [x] `showsPrec` / `showParen` stubs so hand-written Show instances compile.
- [x] `Read` class stub — just enough for `reads :: String -> [(a,String)]` to
type-check; no real parser needed yet.
- [ ] Tests in `lib/haskell/tests/show.sx` (≥ 12 tests: show Int, show Bool,
- [x] Tests in `lib/haskell/tests/show.sx` (≥ 12 tests: show Int, show Bool,
show Char, show String, show list, show tuple, show Maybe, show custom ADT,
deriving Show on multi-constructor type, nested constructor parens).
_Char tests deferred: Char = Int representation; show on a Char is currently
`"97"` not `"'a'"`._
- [ ] Conformance programs:
- `showadt.hs``data Expr = Lit Int | Add Expr Expr | Mul Expr Expr`
with `deriving Show`; prints a tree.
@@ -287,6 +289,16 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-07** — Phase 8 `tests/show.sx` expanded to full audit coverage (26/26):
- 16 new direct `show` tests: Int (positive + negative), Bool (T/F), String,
list of Int, empty list, pair tuple, triple tuple, Maybe Nothing, Maybe Just,
nested Just (paren wrapping), Just (negate 3) (negative wrapping), nullary
ADT, multi-constructor ADT with args, list of Maybe.
- `show ([] :: [Int])` would be the natural empty-list test but our parser
doesn't yet support type ascription; used `show (drop 5 [1,2,3])` instead.
Char `'a'` → `"'a'"` deferred to Char-tagging design (Char = Int currently
yields `"97"`).
**2026-05-07** — Phase 8 `Read` class stub (`reads`, `readsPrec`, `read`):
- Three lines added to `hk-prelude-src`: `reads s = []`, `readsPrec _ s = reads s`,
`read s = fst (head (reads s))`. The stubs let user code that mentions