Closed DK318 closed 2 years ago
Btw, there are 2 more functions in Data.List.NonEmpty
I would consider exporting:
From my experience, the former might be even more useful than groupBy
. You often need to compare by some field and doing groupWith field
is more convenient than groupBy (\a b -> field a < field b)
. The latter is great because it sorts elements. There were a number of times when I made a bug because I (wrongly) expected grouping of all items by group
function. Before I discovered groupAllWith
, I had to do sorting myself a few times.
Description
Problem
At this moment
group
function returns[[a]]
instead of[NonEmpty a]
. Often returning list of lists is unsafe.Solution
Replace
group
export fromData.List
withgroup
,groupBy
,groupWith
andgroupAllWith
fromData.List.NonEmpty
.Related issues(s)
✓ Checklist for your Pull Request
Ideally a PR has all of the checkmarks set.
If something in this list is irrelevant to your PR, you should still set this checkmark indicating that you are sure it is dealt with (be that by irrelevance).
Related changes (conditional)
Tests
Documentation
I checked whether I should update the docs and did so if necessary:
Record your changes
Stylistic guide (mandatory)
[x] My commit history is clean (only contains changes relating to my issue/pull request and no reverted-my-earlier-commit changes) and commit messages start with identifiers of related issues in square brackets.
Example:
[#42] Short commit description
If necessary both of these can be achieved even after the commits have been made/pushed using rebase and squash.