-
Notifications
You must be signed in to change notification settings - Fork 523
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
OOM with endless recursion #749
Comments
Known issue. I'm tempted to put this into the readme. The solution is to use this: https://github.com/oleg-py/better-monadic-for Basically, scalac's default desugaring of |
Actually, this makes me think about Dotty, a bit. casts summon @smarter I'm assuming dotc's desugaring of Like, one possible answer is a scalafix that just removes |
Unlikely. We're trying very hard to avoid having language flags that change language semantics since those can lead to so many issues (e.g., copy-pasting some code in a different project and having it do something different) and it quickly becomes infeasible to test and debug the 2^N combinations of N language flags. However, we would love to get improved for comprehensions in Scala 3, but don't have the resources to work on it ourselves at EPFL. The current blocker is that we really ought to figure out what to do with |
Format it like this: def app[F[_]: Sync](c: Int): F[Unit] = (for {
_ <- Sync[F].delay(if (c % 1000000 == 0) {println(c)})
} yield app(c + 1)).flatMap(next => next) For scalafix removing for-comprehension entirely is unnecessary, it may substitute trailing map by trailing flatMap as above, but leave the rest intact. |
just a wild thought:
|
@neko-kai That does fix the issue, but it's still a little annoying. Like, obviously there are answers here, it's just frustrating that the intuitive use of a language construct can give rise to these scenarios. BMF fixes that, and if the chips fall well on that Dotty issue, perhaps Scala 3 could out of the box. |
Going to close this because there's not much that can be done within Cats Effect itself. It's on the radar of the Scala 3 team though, and BMF is a viable solution in Scala 2. We just need to bring more visibility to each. |
Looking at #89 it seems this issue have been fixed at least once.
app2
works fine.app
leaks memory.The text was updated successfully, but these errors were encountered: