Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add effectful groupByNelA(A => F[B]): F[SortedMap[B, NonEmptyList[A]]] #3420

Closed
ronanM opened this issue May 16, 2020 · 3 comments · Fixed by #3432
Closed

Add effectful groupByNelA(A => F[B]): F[SortedMap[B, NonEmptyList[A]]] #3420

ronanM opened this issue May 16, 2020 · 3 comments · Fixed by #3432

Comments

@ronanM
Copy link

ronanM commented May 16, 2020

Add to cats.syntax.ListOps[A]:

def groupByNelA[F[_] : Applicative, B](f: A => F[B])(implicit B: Order[B]): F[SortedMap[B, NonEmptyList[A]]]

An optimised version of:

as.traverse(a => f(a).tupleLeft(a)).map(_.groupByNel(_._2).mapValues(_.map(_._1)))
@pk044
Copy link
Contributor

pk044 commented May 18, 2020

@ronanM are you perhaps planning to implement this one? I can do it in case it's free to take :)

@ronanM
Copy link
Author

ronanM commented May 18, 2020

It's free. ;-)

@pk044
Copy link
Contributor

pk044 commented May 18, 2020

i'll try to implement that then :)

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 a pull request may close this issue.

2 participants