> 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) .
> 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
>> Cabal-18.104.22.168, 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?
> Beginners mailing list
> [hidden email] > http://www.haskell.org/mailman/listinfo/beginners >
It seems you have two versions of HTTP installed. I'm not really sure
about HTTP-3.x.x.x's API, but I'd wage a guess that it doesn't define
`getRequest`. When importing in ghci, your installation probably picks
the older one instead of the new version.
Try hiding the old package and see if it fixes your problem:
> ghc-pkg hide HTTP-3001.1.13
You can unhide it using `ghc-pkg unhide HTTP-3001.1.13`.