Created
March 18, 2012 14:26
-
-
Save anonymous/2073990 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Network.HTTP | |
import Network.URI | |
import Data.Maybe | |
main :: IO () | |
main = do | |
let req = getRequest "http://hackage.haskell.org/packages/hackage.html" | |
res_ <- simpleHTTP req | |
case res_ of | |
Right res -> do | |
putStrLn "rspCode: " | |
print $ rspCode res | |
putStrLn "rspReason: " | |
print $ rspReason res | |
putStrLn "rspHeaders: " | |
print $ rspHeaders res | |
putStrLn "rspBody: " | |
print $ rspBody res | |
_ -> putStrLn "HTTP response error." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment