haskell: Phase 11 — Data.Map updating (adjust/insertWith/insertWithKey/alter)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m21s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m21s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -187,7 +187,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
- [x] Bulk operations: `fromList`, `toList`, `toAscList`, `keys`, `elems`.
|
||||
- [x] Combining: `unionWith`, `intersectionWith`, `difference`.
|
||||
- [x] Transforming: `foldlWithKey`, `foldrWithKey`, `mapWithKey`, `filterWithKey`.
|
||||
- [ ] Updating: `adjust`, `insertWith`, `insertWithKey`, `alter`.
|
||||
- [x] Updating: `adjust`, `insertWith`, `insertWithKey`, `alter`.
|
||||
- [ ] Module wiring: `import Data.Map` and `import qualified Data.Map as Map`
|
||||
resolve to the `map.sx` namespace dict in the eval import handler.
|
||||
- [ ] Unit tests in `lib/haskell/tests/map.sx` (≥ 20 tests: empty, singleton,
|
||||
@@ -304,6 +304,12 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-07** — Phase 11 updating (adjust/insertWith/insertWithKey/alter):
|
||||
- `adjust` recurses to find the key, replaces value with `f(v)`; no-op when
|
||||
missing. `insertWith` and `insertWithKey` recurse with rebalance and use
|
||||
`f new old` (or `f k new old`) when the key exists. `alter` is the most
|
||||
general, implemented as `lookup → f → either delete or insert`.
|
||||
|
||||
**2026-05-07** — Phase 11 transforming (foldlWithKey/foldrWithKey/mapWithKey/filterWithKey):
|
||||
- Folds traverse in-order. `foldlWithKey f acc m` walks left → key/val → right
|
||||
threading the accumulator, so left-folding `(\acc k v -> acc ++ k ++ v)` over
|
||||
|
||||
Reference in New Issue
Block a user