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
-
Replying to @propensive
is that generalizable? i believe in the current scala all that is required is that the methods have flatmap and the types line up. your syntax additionally requires an HKT
1 reply 0 retweets 2 likes -
Replying to @markcanlasnyc
Yes, it's true that the interpretation of the type constructor would have to be "does the generator's type unify with the type constructor?" which is different from its interpretation for method calls. But I'm not sure that's a problem so much as a subtle difference.
1 reply 0 retweets 0 likes
Replying to @propensive @markcanlasnyc
There are some cases where you would not want the type constructor to affect type inference, for example with an indexed monad.
12:21 PM - 18 Mar 2020
0 replies
0 retweets
0 likes
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.