haskell: Phase 12 — Data.Set skeleton (wraps Data.Map with unit values)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 11:37:39 +00:00
parent e6d6273265
commit 208953667b
2 changed files with 39 additions and 2 deletions

View File

@@ -203,9 +203,9 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
### Phase 12 — Data.Set
- [ ] Implement `Data.Set` in `lib/haskell/set.sx`. Use a standalone
- [x] Implement `Data.Set` in `lib/haskell/set.sx`. Use a standalone
weight-balanced BST (same structure as Map but no value field) or wrap
`Data.Map` with unit values.
`Data.Map` with unit values. _Chose the wrapper approach: Set k = Map k ()._
- [ ] API: `empty`, `singleton`, `insert`, `delete`, `member`, `fromList`,
`toList`, `toAscList`, `size`, `null`, `union`, `intersection`, `difference`,
`isSubsetOf`, `filter`, `map`, `foldr`, `foldl'`.
@@ -307,6 +307,13 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-07** — Phase 12 Data.Set skeleton (wraps Data.Map with unit values):
- New `lib/haskell/set.sx`. `hk-set-empty/singleton/insert/delete/member/
size/null/to-list` all delegate to the corresponding `hk-map-*`. Storage
representation matches Map nodes; values are always `("Tuple")` (unit).
This trades a small per-node memory overhead for a one-line implementation
of every set primitive — full BST balancing comes for free. Spot-checked.
**2026-05-07** — Phase 11 conformance: wordfreq.hs (7/7) + mapgraph.hs (6/6) → Phase 11 complete:
- Extended `hk-bind-data-map!` with `Map.insertWith`, `Map.adjust`, and
`Map.findWithDefault` so the conformance programs have what they need.