haskell: Phase 8 — Read class stub (reads/readsPrec/read) (+3 tests, 10/10)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 00:32:38 +00:00
parent 39c7baa44c
commit d8dec07df3
3 changed files with 25 additions and 2 deletions

View File

@@ -108,7 +108,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
if `show arg` contains a space, emit `"(" ++ show arg ++ ")"`. _Records
deferred — Phase 14._
- [x] `showsPrec` / `showParen` stubs so hand-written Show instances compile.
- [ ] `Read` class stub — just enough for `reads :: String -> [(a,String)]` to
- [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,
show Char, show String, show list, show tuple, show Maybe, show custom ADT,
@@ -287,6 +287,14 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**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
`reads`/`readsPrec` parse and run; calls succeed by always returning an empty
parse list. `read` will throw a pattern-match failure at runtime — fine until
Phase 9 `error` lands. No real parser needed per the plan.
- 3 new tests in `tests/show.sx` (now 10/10).
**2026-05-07** — Phase 8 `showsPrec` / `showParen` / `shows` / `showString` stubs:
- Added 5 lines to `hk-prelude-src`. `shows x s = show x ++ s`,
`showString prefix rest = prefix ++ rest`, `showParen True p s = "(" ++ p (")" ++ s)`,