-
-
Save simonmichael/5005481 to your computer and use it in GitHub Desktop.
http-conduit issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | Fetch the contents of a uri, which must be an ascii string. | |
-- Redirects, authentication, https: and file: uris are supported. | |
readUri :: Manager -> String -> Opts -> IO String | |
readUri manager s opts = | |
case parseURI' s of | |
Just URI{uriScheme="file:",uriPath=f} -> readFeedFile f | |
Just _ -> do | |
r <- parseUrl s | |
let cachecontrol = cache_control opts | |
r' | null cachecontrol = r | |
| otherwise = r{requestHeaders=(hCacheControl, B8.pack cachecontrol):requestHeaders r} | |
rsp <- httpLbs r' manager | |
return $ LB8.unpack $ responseBody rsp -- $$+- return () ? https://github.com/snoyberg/http-conduit/issues/97#issuecomment-12876868 | |
Nothing -> opterror $ "could not parse URI: " ++ s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[3 of 5] Compiling Feed ( Feed.hs, Feed.o ) | |
Feed.hs:183:16: | |
No instance for (Control.Monad.Trans.Resource.MonadResource IO) | |
arising from a use of `httpLbs' | |
Possible fix: | |
add an instance declaration for | |
(Control.Monad.Trans.Resource.MonadResource IO) | |
In a stmt of a 'do' block: rsp <- httpLbs r' manager | |
In the expression: | |
do { r <- parseUrl s; | |
let cachecontrol = cache_control opts | |
r' | |
| null cachecontrol = r | |
| otherwise = ...; | |
rsp <- httpLbs r' manager; | |
return $ LB8.unpack $ responseBody rsp } | |
In a case alternative: | |
Just _ | |
-> do { r <- parseUrl s; | |
let cachecontrol = ... | |
....; | |
rsp <- httpLbs r' manager; | |
.... } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment