Skip to content

Instantly share code, notes, and snippets.

@sadache
Created June 29, 2010 19:19
Show Gist options
  • Save sadache/457652 to your computer and use it in GitHub Desktop.
Save sadache/457652 to your computer and use it in GitHub Desktop.
simpleGet uri error ok =
do resp <- simpleHTTP req
either error
(\r ->
case rspCode r of
(2,_,_) -> ok (rspBody r))
resp
where req=request urii
urii =fromJust $ parseURI uri
getSadacheProfile= do simpleGet
"http://api.twitter.com/1/users/show.json?id=sadache"
(\error -> print ("Error connecting: " ++ show error))
(\r -> print $ (valFromObj "statuses_count"
=<< decode r :: Result Int))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment