Created
January 3, 2018 21:59
-
-
Save amirkarimi/357da157fe9a7dd3ab3be0d5dbaa55d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getCountryByUserId(id: Int): Future[Option[Country]] = { | |
val result = for { | |
user <- OptionT(getUser(id)) | |
city <- OptionT(getCity(user)) | |
country <- OptionT(getCountry(city)) | |
} yield { | |
country | |
} | |
result.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment