Skip to content

Instantly share code, notes, and snippets.

@amirkarimi
Created January 3, 2018 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirkarimi/357da157fe9a7dd3ab3be0d5dbaa55d5 to your computer and use it in GitHub Desktop.
Save amirkarimi/357da157fe9a7dd3ab3be0d5dbaa55d5 to your computer and use it in GitHub Desktop.
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