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

Kyo.foreach* should support more than Seq #1020

Open
hearnadam opened this issue Jan 15, 2025 · 2 comments
Open

Kyo.foreach* should support more than Seq #1020

hearnadam opened this issue Jan 15, 2025 · 2 comments

Comments

@hearnadam
Copy link
Collaborator

Either introduce specialized functions for Set, Map, etc or use an interface like IterableOnce
https://github.com/getkyo/kyo/blob/main/kyo-kernel/shared/src/main/scala/kyo/Kyo.scala#L77-L97

@johnhungerford
Copy link
Contributor

What about the zio approach?

def foreach[A, B, Coll[_], S](collection: Coll[A])(fun: A => B < S)(using bf: BuildFrom[Coll[A], A, Coll[B]): Coll[B] < S = ???

@hearnadam
Copy link
Collaborator Author

Yes, that could work. The lack of specialization may be an issue for performance and or purity... BuildFrom doesn't specify (im)mutability IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants