I'm new to Haskel, I'm trying to run a simple example using http-conduit
, the example is the one provided in their documentation.
However, when running the program I always get:
• Couldn't match expected type ‘Request’ with actual type ‘[Char]’
• In the first argument of ‘httpLBS’, namely
‘"http://httpbin.org/get"’
In a stmt of a 'do' block:
response <- httpLBS "http://httpbin.org/get"
In the expression:
do response <- httpLBS "http://httpbin.org/get"
putStrLn
$ "The status code was: " ++ show (getResponseStatusCode response)
print $ getResponseHeader "Content-Type" response
L8.putStrLn $ getResponseBody response
|
12 | response <- httpLBS "http://httpbin.org/get"
| ^^^^^^^^^^^^^^^^^^^^^^^^
I've tried to create a project both with cabal and stack, add http-conduit
and aeson
as dependencies, but still getting the error.
Shouldn't the url be implicitly converted to a Request
?
I've tried to import Request
and try to create a Request
from the url, but it complains:
import Network.HTTP.Client.Request
<no location info>: error:
Could not load module ‘Network.HTTP.Client.Request’
it is a hidden module in the package ‘http-client-0.6.4.1’