I have hit a problem withe my for comprehension as follows:
def doSomething(): F[String] = {
for {
_ <- Future.traverse(items)(item => doSomeWork(item)) // Future[]
_ <- doSomeOtherWork(42) //F[]
} yield (())
}
The function doSomeWork
looks like:
def doSomeWork(item: Item): Future[Unit] =
// some work done inside a Future
)
and the function doSomeOtherWork
work looks like:
def doSomeOtherWork(i : Int): F[Unit]
So when I try to compile I hit the following error:
[error] found : F[Int]
[error] required: scala.concurrent.Future[?]
[error]
[error] ^
[error] type mismatch;
[error] found : scala.concurrent.Future[Nothing]
[error] required: F[Int]
Am i not allowed to mix F[] and Future inside a for comp like this?