[Haskell-cafe] Downloading web page in Haskell

Michael Snoyman michael at snoyman.com
Sat Nov 20 15:15:23 EST 2010

2010/11/20 José Romildo Malaquias <j.romildo at gmail.com>:
> In order to download a given web page, I wrote the attached program. The
> problem is that the page is not being full downloaded. It is being
> somehow intettupted.
> Any clues on how to solve this problem?

My guess is that there's a character encoding issue. Another approach
would be using the http-enumerator package[1]. The equivalent program

module Main where

import Network.HTTP.Enumerator (simpleHttp)
import qualified Data.ByteString.Lazy as L

main =
  do src <- simpleHttp
     L.writeFile "test.html" src
     L.putStrLn src


[1] http://hackage.haskell.org/package/http-enumerator

More information about the Haskell-Cafe mailing list