Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Just use for comprehension
val start1: Instant =
val fUserInfo1 = for {
nickname <- getNicknameById(userId)
emailAddr <- getEmailAddressByNickname(nickname)
accountInfo <- getAccountInfoByNickname(nickname)
} yield UserInfo(userId, nickname, emailAddr, accountInfo)
val userInfo1 = Await.result(fUserInfo1, 10 second)
val end1: Instant =
println(printInterval(userInfo1, start1, end1)) // UserInfo(31337,ktz,,None) take 7 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment