Here's a Scala 3 feature suggestion: I'd like to write for-comprehensions which know their generator type, like so: for[List] { x <- xs y <- ys } yield ... It would make it much easier to work out whether `xs` or `ys` is the wrong type.
-
Show this thread
-
What happens now: val xs: Option[Int] = … val ys: List[Int] = … for { x <- xs y <- ys } yield x + y error: type mismatch; found : List[Int] required: Option[?] y <- ys The error's misleading because the real mistake is in x <- xs, and it's the wrong way round.
4 replies 0 retweets 16 likesShow this thread -
This Tweet is unavailable.
I certainly hope not!
9:18 AM - 17 Mar 2020
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.