cats icon indicating copy to clipboard operation
cats copied to clipboard

Add missing methods to NE collections and syntax

Open satorg opened this issue 3 years ago • 1 comments

The initial discussion is here.

The following methods are added:

  • NonEmptyList:
    • prependList
  • ListOps:
    • concatNel
  • VectorOps:
    • concatNev
  • SeqOps:
    • concatNeSeq
    • groupByNeSeq (similar to ListOps#groupByNel and VectorOps#groupByNev)
    • groupByNeSeqA (similar to ListOps#groupByNelA and VectorOps#groupByNevA)
    • scanLeftNeSeq (similar to ListOps#scanLeftNel and VectorOps#scanLeftNev)
    • scanRightNeSeq (similar to ListOps#scanRightNel and VectorOps#scanRightNev)

All the new methods are covered by appropriate tests.

Note: this PR is based on #3931. Since by this moment the former PR has not been merged yet, these new methods show up here too:

  • VectorOps:
    • groupByNev
    • groupByNevA
    • scanLeftNev
    • scanRightNev

Technically this PR supersedes the previous one therefore if all changes from both PRs are accepted, then we can just go ahead and merge this PR only and close the other.

satorg avatar Sep 23 '21 02:09 satorg

I appreciate the time you have taken to do this. I find it hard to review code that just adds ad-hoc methods to enrich standard types. It's difficult to know that we are being consistent or that we aren't missing a more general concept that should properly be added to a typeclass (which is the main focus of cats).

johnynek avatar Oct 01 '21 20:10 johnynek