Skip to content

Instantly share code, notes, and snippets.

@pimeys
Last active September 23, 2015 16:47
Show Gist options
  • Save pimeys/dc18def4b0d1dec30e3f to your computer and use it in GitHub Desktop.
Save pimeys/dc18def4b0d1dec30e3f to your computer and use it in GitHub Desktop.
def findUser(params: Map[String,String]): Option[User] =
for {
uid <- params.get("uid")
appid <- params.get("appid")
} yield {
fetchUser(uid, appid)
}
def findUser(params: Map[String,String]): Option[User] =
params.get("uid").flatMap(uid => params.get("appid").map(appid => fetchUser(uid, appid)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment