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

ForEach.fold[I: Identity] is not exposed in syntax #1399

Closed
SimY4 opened this issue Oct 25, 2024 · 2 comments
Closed

ForEach.fold[I: Identity] is not exposed in syntax #1399

SimY4 opened this issue Oct 25, 2024 · 2 comments

Comments

@SimY4
Copy link
Contributor

SimY4 commented Oct 25, 2024

Not sure what hepened there but ForEach.fold is not accessible via syntax extensions.

@sideeffffect
Copy link
Member

Could you please link some example? The best would be something on https://scastie.scala-lang.org/
Also, can you determine what was the last version this worked?

@SimY4
Copy link
Contributor Author

SimY4 commented Oct 28, 2024

Hey @sideeffffect . Thanks for coming back to me on this. I meant this snippet here:

import zio.prelude.*
import zio.prelude.newtypes.*

val l = List(1, 2, 3).map(i => Sum(i))

val f1: Sum[Int] = ForEach[List].fold(l) // works

val f2: Sum[Int] = l.fold // error. not existing

Essentially fold is not being exposed as a syntax extension for ForEach eligible types. But it exists on a ForEach typeclass.

SimY4 added a commit to SimY4/zio-prelude that referenced this issue Nov 7, 2024
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

No branches or pull requests

2 participants