Skip to content

Instantly share code, notes, and snippets.

@notyy
Created June 2, 2012 08:54
Show Gist options
  • Save notyy/2857397 to your computer and use it in GitHub Desktop.
Save notyy/2857397 to your computer and use it in GitHub Desktop.
login
def requestAccToken(code:String): Option[String] = if(code=="bad") None else Some("token")
def requestOpenId(token:String): Option[String] = Some("openId")
def requestUserInfo(openId:String): Option[String] = Some("notyy's account")
def getUser(code:String):Option[String] = requestAccToken(code) flatMap(requestOpenId) flatMap(requestUserInfo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment