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.
The compiler would need to know how to construct the value without an existing value to work from, so it would need to infer the companion object from the TC, and call `unit` on it, which would need to be added to all the monad types.
-
-
I'm not sure how that would work for anything other than simple type constructors (a type lambda has no companion), but those probably would be the *useful* cases.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.