Skip to content

Create specialized fromList functions for Sets

What does this MR do?

This MR adds 4 new functions to Data.Set that provide alternatives to the fromList with increased performance, but are not as widely applicable.

In particular it adds the fromAscList and fromDescList functions that construct a Set from ordered lists in O(n), and the fromDistinctAscList and fromDistinctDescList functions that are even faster still, but assume that the lists do not contain any duplicate elements.

Related issues

itasks-sdk#474 (closed)

Changes to public APIs

4 new functions have been added, the semantics of existing functions have not been changed.

fromAscList :: ![a] -> Set a | == a
fromDescList :: ![a] -> Set a | == a
fromDistinctAscList :: ![a] -> Set a
fromDistinctDescList :: ![a] -> Set a

Author's checklist (required)

See CONTRIBUTING.md for the rationale behind these items:

  • The commit history does not contain merges (use git rebase -i master if it does)
  • Intermediate commits compile (use git rebase -i master if not)
  • Newly added code follows the Platform code style
  • Newly added code is documented
  • If bugs have been solved, tests have been added
  • Appropriate types have been used, especially in APIs
  • If efficiency is part of the acceptance criteria of the issue, a benchmark is provided
  • A changelog entry has been added if required. See CONTRIBUTING.md
Edited by Erin van der Veen

Merge request reports

Loading