haskell: Phase 14 — record syntax in parser (con-rec AST node)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m1s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 15:07:38 +00:00
parent 2adbc101fa
commit ca9e12fc57
2 changed files with 49 additions and 11 deletions

View File

@@ -247,7 +247,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
### Phase 14 — Record syntax
- [ ] Parser: extend `hk-parse-data` to recognise `{ field :: Type, … }`
- [x] Parser: extend `hk-parse-data` to recognise `{ field :: Type, … }`
constructor bodies. AST node: `(:con-rec CNAME [(FNAME TYPE) …])`.
- [ ] Desugar: `:con-rec` → positional `:con-def` plus generated accessor
functions `(\rec -> case rec of …)` for each field name.
@@ -313,6 +313,13 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-07** — Phase 14 record parser: `data Foo = Foo { name :: T, … }`:
- Extended `hk-parse-con-def` to peek for `{` after the constructor name; if
found, parse `varid :: type` pairs separated by commas, terminate with `}`,
return `(:con-rec name [(fname ftype) …])`. Positional constructors fall
through to the existing `:con-def` path. Verified record parses; no
regressions in parse.sx (43/43), parser-decls (24/24), deriving (15/15).
**2026-05-07** — Phase 13 conformance: shapes.hs (5/5) → Phase 13 complete:
- `class Shape` with a default `perimeter` (using a where-clause inside the
default body), two instances `Square` / `Rect` — Square overrides