refactor: conflict detection uses O(n²) elem on lists — switch to Set operations #26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Both
intraConflictandconflictingNameinDSL.Validateperform membership tests usingelemon lists afternubOrd:nubOrdbuilds aSetinternally to deduplicate but then returns a list, throwing away theSet. The subsequentelemrebuilds the membership cost from scratch.Fix
Build
Set Textonce per action list and useSet.intersection/Set.member:Data.Setis already imported inDSL.Validate(used byduplicateName), so no new dependency is needed.Note
The action-extraction pattern (
[name | ServiceAction (Service.Enable (Service.ServiceName name)) <- actions]) is also duplicated 4× acrossintraConflictandconflictingName. Extracting helpersextractEnabled :: [Action] -> Set TextandextractDisabled :: [Action] -> Set Textwould address both issues at once.