I'm having this issue where I use a for-comprehension in Scala to chain some Futures, and then get an instance of a class with some of those values. The problem is that the val I assign the value to, is of type Future[MyClass] instead of MyClass and I can't seem to figure out why.
The code is something like this:
val future = someService.someFutureReturningMethod()
val x = for{
a <- future
b <- someOtherService.someOtherFutureMethod(a)
} yield {
MyClass(b.sth, b.sthElse)
}
The problem here is that x ends up being of type Future[MyClass] and not MyClass and I can't seem to figure out why.