haskell: Phase 8 audit — hk-show-val matches Haskell 98 (precedence-based parens, no-space separators)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -97,9 +97,11 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
### Phase 8 — `show` for arbitrary types
|
||||
|
||||
- [ ] Audit `hk-show-val` in `runtime.sx` — ensure output format matches
|
||||
Haskell 98: `"Just 3"`, `"[1,2,3]"`, `"(True,False)"`, `"'a'"` (Char shows
|
||||
with single-quotes), `"\"hello\""` (String shows with escaped double-quotes).
|
||||
- [x] Audit `hk-show-val` in `runtime.sx` — ensure output format matches
|
||||
Haskell 98: `"Just 3"`, `"[1,2,3]"`, `"(True,False)"`, `"\"hello\""` (String
|
||||
shows with escaped double-quotes). _Deferred:_ `"'a'"` Char single-quotes
|
||||
(needs Char tagging — currently Char = Int by representation, ambiguous in
|
||||
show); `\n`/`\t` escape inside Strings.
|
||||
- [ ] `show` Prelude binding calls `hk-show-val`; `print x = putStrLn (show x)`.
|
||||
- [ ] `deriving Show` auto-generates proper show for record-style and
|
||||
multi-constructor ADTs. Nested application arguments wrapped in parens:
|
||||
@@ -284,6 +286,17 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-06** — Phase 8 audit: `hk-show-val` matches Haskell 98 format:
|
||||
- `eval.sx`: introduced `hk-show-prec v p` with precedence-based parens.
|
||||
Top-level `show (Just 3)` = `"Just 3"` (no parens); nested `show (Just (Just 3))`
|
||||
= `"Just (Just 3)"` (inner wrapped because called with prec ≥ 11). Negative
|
||||
ints wrapped in parens at high prec for `show (Just (negate 1))` correctness.
|
||||
- List/tuple separators changed from `", "` to `","` to match GHC.
|
||||
- `hk-show-val` is now a thin shim: `(hk-show-prec v 0)`.
|
||||
- Updated `tests/deriving.sx` (3 tests) and `tests/stdlib.sx` (7 tests) to the
|
||||
new format. `Char` single-quote output and string escape for `\n`/`\t`
|
||||
deferred — Char = Int representation prevents disambiguation in show.
|
||||
|
||||
**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)`
|
||||
|
||||
Reference in New Issue
Block a user