Skip to content

GhcOptions: use NubListR where appropriate. - #2111

Merged
23Skidoo merged 3 commits into
haskell:masterfrom
23Skidoo:ghc-options-union
Oct 19, 2014
Merged

23Skidoo merged 3 commits into
haskell:masterfrom
23Skidoo:ghc-options-union

Conversation

@23Skidoo

Copy link
Copy Markdown
Member

Some Cabal API clients apparently use foldl mappend on large lists of GhcOptions records. Fixes #2110.

@23Skidoo
23Skidoo force-pushed the ghc-options-union branch 2 times, most recently from af176a7 to 05ad067 Compare September 17, 2014 22:33
@23Skidoo
23Skidoo force-pushed the ghc-options-union branch 4 times, most recently from 3648af5 to c223872 Compare September 27, 2014 14:39
23Skidoo referenced this pull request in erikd/cabal Oct 18, 2014
During implementation and testing of the 'saved-config update' feature,
it was found that `mappend`ing SavedConfig could result in duplicate
entries in some fields which were lists, eg the fields extra-prog-path,
remote-repo and build-summary.

The solution was to add and use a 'NubList a' type, a list where every
element in the list is unique to the list and the original list ordering
is maintained. The Monoid NubList's mappend implement is just:

    NubList xs `mappend` NubList ys = NubList . nub $ xs ++ ys

which preserves NubList's required properties (ordering and unique-ness
of elements) and meets the requirements of the Monoid laws (identity,
associativity and closure).

Closes: haskell#2160
Some Cabal API clients apparently use `foldl mappend` on large lists of
`GhcOptions` records. Fixes haskell#2110.
@23Skidoo

Copy link
Copy Markdown
Member Author

Updated to use NubListR instead of listUnionRight.

@23Skidoo 23Skidoo changed the title GhcOptions.mappend: use Data.List.union where appropriate. GhcOptions: use NubListR where appropriate. Oct 19, 2014
23Skidoo added a commit that referenced this pull request Oct 19, 2014
GhcOptions: use `NubListR` where appropriate.
@23Skidoo
23Skidoo merged commit cfda520 into haskell:master Oct 19, 2014
@23Skidoo
23Skidoo deleted the ghc-options-union branch October 19, 2014 16:15
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.

ghcOptExtensionMap can get absurdly big

1 participant