sortOn functions using same heap as sort and unstableSort (#500)
authorDonnacha Oisín Kidney <oisdk@users.noreply.github.com>
Mon, 22 Jan 2018 05:38:36 +0000 (05:38 +0000)
committerDavid Feuer <David.Feuer@gmail.com>
Mon, 22 Jan 2018 05:38:36 +0000 (00:38 -0500)
commitfa59282b04240becfb577f758378d6d6e115d8f2
tree04ccc82e39f7dd30421df9d68a99153e392d1abe
parentb43646a788f7762474d63da97d3a23da65690bb9
sortOn functions using same heap as sort and unstableSort (#500)

Add

```haskell
sortOn, unstableSortOn :: Ord b => (a -> b) -> Seq a -> Seq a
```

analogous to `Data.List.sortOn`. We minimize the performance cost by integrating the decorate-sort-undecorate paradigm into the heap structure. It will still be somewhat faster to use ``sortBy (compare `on` f)`` than `sortOn f` if `f` is very cheap, but otherwise `sortOn` will be faster.
Data/Sequence.hs
Data/Sequence/Internal.hs
Data/Sequence/Internal/Sorting.hs [new file with mode: 0644]
Data/Sequence/Internal/sorting.md [new file with mode: 0644]
Data/Sequence/sorting.md [deleted file]
Utils/Containers/Internal/State.hs [new file with mode: 0644]
benchmarks/Sequence.hs
containers.cabal
tests/seq-properties.hs