haskell: Phase 11 — Data.Map combining (unionWith/intersectionWith/difference)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m56s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 10:00:45 +00:00
parent 12de24e3a0
commit 95cf653ba9
2 changed files with 57 additions and 1 deletions

View File

@@ -185,7 +185,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
- [x] Core operations: `empty`, `singleton`, `insert`, `lookup`, `delete`,
`member`, `size`, `null`.
- [x] Bulk operations: `fromList`, `toList`, `toAscList`, `keys`, `elems`.
- [ ] Combining: `unionWith`, `intersectionWith`, `difference`.
- [x] Combining: `unionWith`, `intersectionWith`, `difference`.
- [ ] Transforming: `foldlWithKey`, `foldrWithKey`, `mapWithKey`, `filterWithKey`.
- [ ] Updating: `adjust`, `insertWith`, `insertWithKey`, `alter`.
- [ ] Module wiring: `import Data.Map` and `import qualified Data.Map as Map`
@@ -304,6 +304,13 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-07** — Phase 11 combining (unionWith/intersectionWith/difference):
- All three implemented via `reduce` over the smaller map's `to-asc-list`,
inserting / skipping into the result. Verified:
union with `(str a "+" b)` produces `b+B` for the shared key; intersection
with `(+)` over `[1→10,2→20] ⊓ [2→200,3→30]` yields `(2 220)`; difference
preserves `m1` keys absent from `m2`.
**2026-05-07** — Phase 11 bulk operations (fromList/toList/toAscList/keys/elems):
- `hk-map-from-list` uses SX `reduce` — left-to-right, so duplicates resolve
with last-wins (matches GHC `fromList`). `to-asc-list` is in-order recursive