-
Notifications
You must be signed in to change notification settings - Fork 21
cannot overload flatMap #11232
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
Comments
So would you say the issue here is that |
I think both makes sense for
I expected this to already work and still don't understand, why this extension is different from other implicit extensions. Hence it made it to scala/bug. As there are many more Monads in principle, there are also many more of possible So if I have to choose, then focus on
|
I'd suggest moving this to https://contributors.scala-lang.org, since this still in the figuring-out-what-is-even-going-on stage, rather than the reasonably-certain-this-is-in-fact-a-bug stage I know other open source projects vary in how they do this, but in Scala, scala/bug is for bug reports, discussions are on Discourse |
Looks like this is an actual bug after all :-) |
there is some discussion at https://contributors.scala-lang.org/t/cannot-overload-flatmap/2556/10 the relevant piece of the spec is SLS 7.3, point 3: https://twitter.com/headinthebox/status/1046521593524965376 |
This comment has been minimized.
This comment has been minimized.
There seems to be ticket for this: #9523 |
nice, thanks for finding that! |
thanks a lot for finding the underlying cause |
Dear Scala developers,
I just stumbled upon the standard case that Option and Iterable might be hard to intertwine in a scala for loop. See for instance this stackoverflow question
I tried to fix this by just overloading
flatMap
with a version which should work, however it doesn't.When I run the following in scala 2.11.12 REPL
I get the following outputs
As you can see it perfectly works when using my dummy
flatMap2
, but fails forflatMap
itself.If this would work, it could massively simplify the support of complex
flatMap
chainings and hence complexfor
loops with different Monads intermixing a baseIterable
Monad.The text was updated successfully, but these errors were encountered: