Skip to content

Instantly share code, notes, and snippets.

@sadache
Created June 28, 2010 23:35
Show Gist options
  • Save sadache/456551 to your computer and use it in GitHub Desktop.
Save sadache/456551 to your computer and use it in GitHub Desktop.
main = do resp <- simpleHTTP request
case resp of
Left x -> print ("Error connecting: " ++ show x)
Right r ->
case rspCode r of
(2,_,_) ->
print $ ( valFromObj "statuses_count"
=<< decode (rspBody r) :: Result Int)
where
request=Request {rqURI = uriSadache,
rqMethod = GET,
rqHeaders = [],
rqBody = ""}
uriSadache= fromJust $ parseURI "http://api.twitter.com/1/users/show.json?id=sadache"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment