Suppose I have the following code:
val either: Either[String, (Int, Int)] = Right((1,2)) for { (a, b) <- either.right } yield a + b
When I evaluate it in REPL, I get
: 13: error: constructor could not be created for the expected type; found: (T1, T2) required: scala.util.Either [Nothing, (Double, Double)] (a, b) <- a.right ^: 14: error: not found: value a} give a + b ^
Why do I have such an error? Can't I match the matching tuple with Either?
source share