Created
January 3, 2018 22:01
-
-
Save amirkarimi/5e3cd74c9e5c7775d48446a25ef6fc5d 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[Either[String, Country]] = { | |
val result = for { | |
user <- EitherT(getUser(id)) | |
city <- EitherT(getCity(user)) | |
country <- EitherT(getCountry(city)) | |
} yield { | |
country | |
} | |
result.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment