[Haskell-cafe] Two GET HTTP requests

Ben Millwood haskell at benmachine.co.uk
Sun Feb 7 12:12:23 EST 2010

On Fri, Feb 5, 2010 at 5:51 PM, Chris Eidhof <chris at eidhof.nl> wrote:
> Approach 2: I installed the 'download-curl' package, and tried again. This seems to fail on the following example:
>> import Network.Curl.Download
>> main = do x <- openURI "http://haskell.org"
>>           y <- openURI "http://haskell.org/hoogle"
>>           return ()
> If I put a print statement around the second line of the do-statement it looks like openURI never returns.

I think you're supposed to use withCurlDo:
with the curl library. Could be wrong about that, haven't tried it myself.

> Approach 3: I used the simpleHTTP function from the HTTP package. This crashed, after I dug a little deeper into the code, it threw an error on calling the parseURI function (openFile: no such file exists). I installed the latest network package and upgraded my HTTP package, and the parseURI error went away. I felt like I was almost there, and tried the following:
>> simpleHTTP (getRequest "http://haskell.org")
> This failed with just the text "Bus error". I searched the HTTPBis git repository, but couldn't find the text "Bus error". I don't have a clue of how to fix this.

"Bus error" is a message generated by the operating system. On OS X,
it can mean a null dereference, which is very unusual. I'm not sure
how you'd debug it either - the most common cause when you're talking
about C applications is programmer error, but Network.HTTP is
specifically designed to be pure Haskell, and it's not easy to induce
a null dereference from Haskell.

> I'm a bit stuck here, I would love to help fix the errors, but don't know what would be the best place to begin. If anyone can point me in the right direction, I will try to patch at least one of these packages.

I don't think anyone would blame you if you didn't manage it, none of
those are particularly friendly errors.

More information about the Haskell-Cafe mailing list