haskell: Phase 8 deriving Show — verify nested-paren behavior (+4 tests, 15/15)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,9 +103,10 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
(needs Char tagging — currently Char = Int by representation, ambiguous in
|
||||
show); `\n`/`\t` escape inside Strings.
|
||||
- [x] `show` Prelude binding calls `hk-show-val`; `print x = putStrLn (show x)`.
|
||||
- [ ] `deriving Show` auto-generates proper show for record-style and
|
||||
- [x] `deriving Show` auto-generates proper show for record-style and
|
||||
multi-constructor ADTs. Nested application arguments wrapped in parens:
|
||||
if `show arg` contains a space, emit `"(" ++ show arg ++ ")"`.
|
||||
if `show arg` contains a space, emit `"(" ++ show arg ++ ")"`. _Records
|
||||
deferred — Phase 14._
|
||||
- [ ] `showsPrec` / `showParen` stubs so hand-written Show instances compile.
|
||||
- [ ] `Read` class stub — just enough for `reads :: String -> [(a,String)]` to
|
||||
type-check; no real parser needed yet.
|
||||
@@ -286,6 +287,16 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-06** — Phase 8 `deriving Show` nested constructor parens verified:
|
||||
- The Phase 8 audit's precedence-based `hk-show-prec` already does the right
|
||||
thing for `deriving Show`: each constructor arg is shown at prec 11, so any
|
||||
inner constructor with args (or any negative number) gets parenthesised, while
|
||||
nullary constructors and lists/tuples (whose own bracketing is unambiguous)
|
||||
do not. Multi-constructor ADTs (e.g. `Tree = Leaf | Node …`) handled.
|
||||
Records deferred to Phase 14.
|
||||
- 4 new tests in `tests/deriving.sx` exercising nested ADT + Maybe-Maybe +
|
||||
negative-arg + list-arg cases; suite is 15/15.
|
||||
|
||||
**2026-05-06** — Phase 8 `print` is `putStrLn (show x)` in prelude:
|
||||
- Added `print x = putStrLn (show x)` to `hk-prelude-src` and removed the
|
||||
standalone `print` builtin. `print` now resolves through the Haskell-level
|
||||
|
||||
Reference in New Issue
Block a user