문제

Why is such simple code not working?

import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as L

main :: IO ()
main = simpleHttp "http://www.dir.bg/" >>= L.putStr

It results in the following error:

TestConduit.exe: InternalIOException getAddrInfo: does not exist (error 10093)

도움이 되었습니까?

해결책

You have to use withSocketsDo to initialize sockets. Like this:

import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as L
import Network (withSocketsDo)

main :: IO ()
main = withSocketsDo
      $ simpleHttp "http://www.dir.bg/" >>= L.putStr
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top