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
Allow implicit modifier in for comprehension #2823
Comments
Imported From: https://issues.scala-lang.org/browse/SI-2823?orig=1 |
@odersky said: |
@odersky said: |
Kim Stebel (kimstebel) said: About patterns: I think the behaviour should be analogous to implicit val = ... where the implicit modifier does apply to all variables in the pattern. |
@gkossakowski said: |
Mike Slinn (mslinn) said: for { implicit x <- Some(1) } yield x |
Harold Lee (harold) said (edited on Apr 11, 2015 6:40:05 AM UTC): SIP: scala/docs.scala-lang#417 Code in progress: https://github.com/haroldl/scala/tree/sip24 |
@som-snytt said: I'll also try to address #9158 by tupling extraction results instead of reapplying patterns downstream of midstream assignments. I see the SIP proposal pushes them into the body, which came up when Kim Stebel asked about it. |
@retronym said: |
Juan Manuel Serrano (jserrano) said: trait MyStateMonad[F[_]] extends MonadState[F, Int]{
import scalaz.syntax.monad._
implicit val _ = this // necessary in order to use the syntactic sugar
...
} it'd be nice to be able to write that just as follows: trait MyStateMonad[F[_]] extends MonadState[F, Int]{ implicit this =>
import scalaz.syntax.monad._
...
} |
Since https://contributors.scala-lang.org/t/implicit-keyword-in-lhs-of-for-comprehension/725/3 asked about the status: There's also scala/slip#6 and scala/scala#4730. The latter PR is probably the most complete (and least ambitious), but it was held back because a SIP was required (and the SIP wasn't championed). Quoting: scala/slip#6 (comment)
Latest status@SethTisue wrote in scala/slip#6 (comment) on Nov 30, 2016:
|
Just to let anyone arriving here know, it's already possible to do that with More info: https://github.com/oleg-py/better-monadic-for#define-implicits-in-for-comprehensions-or-matches 😉 |
dotty syntax reminder
scala 2 syntax reminder
It looks like the last piece was just "pattern bound implicit" syntax
|
Outgrowth of #1492, but that ticket has already been closed twice and the most important case works great. But as mentioned in its comments it would be useful and more consistent if this also worked:
The text was updated successfully, but these errors were encountered: