haskell: Phase 14 — record patterns Foo { f = b } in case + fun-clauses
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -259,7 +259,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
tagged list. Field → index mapping stored in `hk-constructors` at registration.
|
||||
_Field map lives in `hk-record-fields` (desugar.sx) for load-order reasons,
|
||||
not `hk-constructors`._
|
||||
- [ ] Exhaustive record patterns: `Foo { bar = b }` in case binds `b`,
|
||||
- [x] Exhaustive record patterns: `Foo { bar = b }` in case binds `b`,
|
||||
wildcards remaining fields.
|
||||
- [ ] Tests in `lib/haskell/tests/records.sx` (≥ 12 tests: creation, accessor,
|
||||
update one field, update two fields, record pattern, `deriving Show` on
|
||||
@@ -315,6 +315,18 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-07** — Phase 14 record patterns `Foo { bar = b }`:
|
||||
- Parser: `hk-parse-pat-lhs` now peeks for `{` after a conid; if found, calls
|
||||
`hk-parse-rec-pat` which collects `(fname pat)` pairs and emits `:p-rec`.
|
||||
- Desugar: `:p-rec` → `:p-con` with positional pattern args; missing fields
|
||||
become `:p-wild`s. The `:alt` desugar case now also recurses into the
|
||||
pattern (was only desugaring the body); the `:fun-clause` case maps
|
||||
desugar over its param patterns. Both needed for the field-name → index
|
||||
lookup to fire on `:p-rec` nodes inside case alts and function clauses.
|
||||
- Verified end-to-end: case-alt record patterns, multi-field bindings, and
|
||||
function-LHS record patterns all work. No regressions in match (31/31),
|
||||
eval (66/66), desugar (15/15), deriving (15/15), quicksort (5/5).
|
||||
|
||||
**2026-05-07** — Phase 14 record-update syntax `r { field = v }`:
|
||||
- Parser: `varid {` after a primary expression now triggers
|
||||
`hk-parse-rec-update` returning `(:rec-update record-expr [(fname expr) …])`.
|
||||
|
||||
Reference in New Issue
Block a user