[Haskell-beginners] Network.HTTP basics

Barbara Shirtcliff barcs at gmx.com
Fri Apr 1 21:42:19 CEST 2011

Hi, this is small, but this is the beginners list, so here goes:

I can see how to use HTTP to request a page.  for example, this works:

Prelude Network.HTTP> let respgoogle = simpleHTTP $ getRequest "http://google.com"
Prelude Network.HTTP> respgoogle
Right HTTP/1.1 301 Moved Permanently 
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Fri, 01 Apr 2011 17:31:25 GMT
Expires: Sun, 01 May 2011 17:31:25 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 1; mode=block
Connection: close

that looks really nice, but hey, what if I want to see what's in the content?  It isn't immediately clear to me from the documentation at http://hackage.haskell.org/packages/archive/HTTP/4000.1.1/doc/html/Network-HTTP.html .

In the end, I'll be working with JSON, here, but I need to know how to get to it, and the examples in the documentation don't work (i.e. don't appear to be up to date).  I'm not very experienced with Haskell, so, it's pretty opaque.


More information about the Beginners mailing list