[Haskell-beginners] Fetching a URI

Adam Keys adamkkeys at gmail.com
Sun Apr 5 23:07:16 EDT 2009


I'm trying to write a wrapper for a REST service. However, I find  
myself stumped by the simplest part: merely performing a GET on a URI.

I'm using the HTTP Cabal package. It specifies an example like so:

> simpleHTTP (getRequest "http://www.haskell.org/") >>= fmap (take  
> 100) . getResponseBody


However, it seems I'm either importing the library incorrectly or  
there is a discrepancy between the documentation and the library. I  
can't seem to call getRequest.

> :) ghc-pkg list
> ...
> /Users/adamkeys/.ghc/i386-darwin-6.8.2/package.conf:
>     Cabal-1.6.0.1, HTTP-3001.1.3, HTTP-4000.0.4, Shellac-0.9.5,
> ...
>
> GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
> Loading package base ... linking ... done.
> Prelude> import Network.HTTP
> Prelude Network.HTTP> :type getRequest
>
> <interactive>:1:0: Not in scope: `getRequest'

Am I missing something obvious here?

--
~akk



More information about the Beginners mailing list