Skip to content

Refactor getContextDiffNumbered with separate Nothing equation#27

Merged
ddssff merged 1 commit into
seereason:masterfrom
tweag:nothing-equation
Jun 4, 2026
Merged

Refactor getContextDiffNumbered with separate Nothing equation#27
ddssff merged 1 commit into
seereason:masterfrom
tweag:nothing-equation

Conversation

@ninioArtillero

@ninioArtillero ninioArtillero commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Adding an extra equation for the Nothing case lifts the burden of handling it at doPreffix and doSuffix, resulting in clearer code and avoiding unnecessary traversals of getGroupedDiff a0 b0 output. The key insight is that the Nothing case results in all elements being preserved by doPrefix+doSuffix, i.e. no Both is split, and thus producing a single hunk with the output of getGroupedDiff.

It is also of note that calls to max were already no-ops as drop truncates negatives to 0.

Comment thread src/Data/Algorithm/DiffContext.hs Outdated
@ninioArtillero ninioArtillero marked this pull request as ready for review May 26, 2026 01:25
@ninioArtillero ninioArtillero changed the title Rebase getContextDiffNumbered with separate Nothing equation Refactor getContextDiffNumbered with separate Nothing equation May 26, 2026
@ninioArtillero

Copy link
Copy Markdown
Collaborator Author

@ddssff This is ready for your review 🙂

@ddssff ddssff merged commit 2cbd392 into seereason:master Jun 4, 2026
12 checks passed
@ninioArtillero ninioArtillero deleted the nothing-equation branch June 8, 2026 22:28
@ddssff

ddssff commented Jun 12, 2026

Copy link
Copy Markdown
Member

Any thoughts about #1?

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.

3 participants