Skip to content

Improve zapping for maps - #219

Merged
Soupstraw merged 6 commits into
masterfrom
jj/zap-map
Nov 18, 2026
Merged

Soupstraw merged 6 commits into
masterfrom
jj/zap-map

Conversation

@Soupstraw

@Soupstraw Soupstraw commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR makes the zappers generate duplicate key value pairs inside maps.

@Soupstraw
Soupstraw marked this pull request as ready for review November 3, 2026 10:01
@Soupstraw
Soupstraw force-pushed the jj/zap-map branch 5 times, most recently from 7f1054b to dd24adc Compare November 3, 2026 14:44
@Soupstraw
Soupstraw requested a review from neilmayhew November 3, 2026 14:47

@teodanciu teodanciu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (the little that I understand - might be good to get another review from someone who knows more about it!)

Comment thread src/Codec/CBOR/Cuddle/CBOR/Gen.hs Resolved
Comment thread src/Codec/CBOR/Cuddle/CBOR/Gen.hs Resolved
@Soupstraw
Soupstraw merged commit 12b1d33 into master Nov 18, 2026
7 of 11 checks passed
@Soupstraw
Soupstraw deleted the jj/zap-map branch November 18, 2026 13:35
mKV <- annotate (T.pack $ show i') $ tryGenKV 100 m' kNode vNode
case mKV of
Just (k, v) -> genElems (i' + 1) ((k, v) : m') $ nElems - 1
Nothing -> pure Nothing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return what we have if we are inside valid range

let
(lInit, lTail) = splitAt idx ts
twiddleArray $ lInit <> [junkElem] <> lTail
genCorruptedList `suchThat` \l -> isInvalidAgainstNode cTreeRoot l (Array nodes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recheck only against the unused rules, not against all the rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants