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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forEachCollectSome #1160

Open
wants to merge 2 commits into
base: series/2.x
Choose a base branch
from
Open

Add forEachCollectSome #1160

wants to merge 2 commits into from

Conversation

0pg
Copy link
Contributor

@0pg 0pg commented Jul 9, 2023

Hi, Here comes foreach filter again 馃槄
Added infix syntax forEachCollectSome of collect after forEach
(and there is one more for Iterable optimized, this is why the new syntax added instead of using composition of collect after forEach on demand)

@0pg 0pg requested a review from a team as a code owner July 9, 2023 18:02
Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

val builder = bf.newBuilder(in)

lazy val recurse: Option[B] => ZPure[W, S, S, R, E, Collection[B]] = { b =>
b.fold(builder)(builder += _)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't .forEach clearer here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. I changed those
6809853 (#1160)

@adamgfraser
Copy link
Contributor

We already have collectM.

@0pg
Copy link
Contributor Author

0pg commented Jul 12, 2023

yeah but can't it only be used with the same effect?
ex) List[A] can only get PartialFunction[A, List[B]] not PartialFunction[A, ZIO[R, E, B]]

@sideeffffect
Copy link
Member

Hello @0pg , are you still interested in getting this merged? Could you please resolve the git conflict?

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 this pull request may close these issues.

None yet

3 participants