object Example extends App {
val result = for {
a <- Some(22.5)
b <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
c <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
(aa, bb) <- b
d <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
e <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
f <- Some(123123.213)
g <- Some(123123.232)
h <- Some(234234.22)
i = g * h
} yield 10
}
//scala: type mismatch;
//found : scala.collection.immutable.Iterable[Int]
//required: Option[?]
//(aa, bb) <- b
//^
Asked
Active
Viewed 80 times
0

om-nom-nom
- 62,329
- 13
- 183
- 228

Ryan LeCompte
- 4,281
- 1
- 14
- 14
-
also http://stackoverflow.com/questions/14949831/remedial-syntax-issue-with-for-comprehension-in-scala?lq=1 – om-nom-nom Mar 06 '13 at 22:45
-
Start by figuring out what value you expected it to return. Note that the value must be an `Option`. – Daniel C. Sobral Mar 06 '13 at 23:02