Skip to content

Instantly share code, notes, and snippets.

@gfontenot
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfontenot/134eeaa493dab11a0e02 to your computer and use it in GitHub Desktop.
Save gfontenot/134eeaa493dab11a0e02 to your computer and use it in GitHub Desktop.
The JSON Parsing example from http://robots.thoughtbot.com/real-world-json-parsing-with-swift without operators
return bind(_JSONParse(json)) { (d: JSONObject) in
fmap(User.create, apply(bind(d["id"], _JSONParse),
apply(bind(d["name"], _JSONParse),
apply(pure(bind(d["email"], _JSONParse))))))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment