You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implicit val ec: ExecutionContext = ExecutionContext.global
val foo = for {
x <- Future[Any](5)
} yield x match {
case i: Int =>
case s: String =>
}
Produces the error:
[error] Match instead of partial function
A map match can be replaced with a partial function for greater readability: scala.concurrent.Future.apply[Any](5)(ec).map[Unit](((x: Any) => x match {
case (i @ (_: Int)) => ()
case (s @ (_: String)) => ()
}))
However, there is no way to do that, since the map is implicitly part of the yield.
The text was updated successfully, but these errors were encountered:
I'm seeing the same warning when using the better-monadic-for compiler plugin, e.g.:
valab=for {
(a, b) <-Some(("a", "b"))
} yield a + b
Results in the following:
Match instead of partial function
A map match can be replaced with a partial function for greater readability: scala.Some.apply[(String, String)](scala.Tuple2.apply[String, String]("a", "b")).map[String](((x$6: (String, String)) => x$6 match {
case (_1: String, _2: String)(String, String)((a @ _), (b @ _)) => a.+(b)
}))
Match instead of partial function
(a, b) <- Some(("a", "b"))
Produces the error:
However, there is no way to do that, since the
map
is implicitly part of the yield.The text was updated successfully, but these errors were encountered: