次のコードでは、future
のyield
を含むPlay for Scala機能があります。コンパイルエラーtype mismatch; found : scala.concurrent.Future[Nothing] required: play.api.mvc.Result
が表示されます。 Ok
の返信を返すために、私はフラットではないでしょうか?Scala用Playの将来の返品返品
def f1 = Future { 1 }
def f2 = Future { 2 }
def index = Action.async (parse.json) { request =>
for { x1 <- f1 }
yield {
val f = f2
f.flatMap { result =>
Ok("X")
}
}
}
'Future'の' yield'に 'Future.flatMap'を使用すると... – cchantep