list-t-libcurl 0.2.0.1 → 0.2.0.2
raw patch · 2 files changed
+11/−15 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- library/ListT/Libcurl.hs +10/−14
- list-t-libcurl.cabal +1/−1
library/ListT/Libcurl.hs view
@@ -8,7 +8,7 @@ where import BasePrelude hiding (cons, uncons)-import Foreign hiding (Pool, void)+import Foreign hiding (Pool, void, unsafePerformIO) import MTLPrelude hiding (Error) import Control.Monad.Trans.Either hiding (left, right) import ListT (ListT)@@ -30,7 +30,9 @@ {-# NOINLINE pool #-} pool :: P.Pool C.CURL pool =- unsafePerformIO $ P.createPool acquire release 1 30 100+ unsafePerformIO $ do+ C.loadlib C.CURL720+ P.createPool acquire release 1 30 100 where acquire = do h <- C.curl_easy_init@@ -55,7 +57,6 @@ runSession :: Session a -> IO (Either Error a) runSession (Session m) = try $- C.withlib C.CURL720 $ P.withResource pool $ runReaderT m @@ -71,17 +72,12 @@ result <- newEmptyMVar :: IO (MVar (Either SomeException a)) forkIO $ do r <- - try $ consumer $ fix $ \loop -> do- chunk <- - lift $ atomically $- tryTakeTMVar chunk >>= \case- Just chunk -> return $ Just chunk- _ -> readTVar active >>= \case- False -> return Nothing- _ -> retry- case chunk of- Nothing -> mzero- Just chunk -> L.cons chunk loop+ try $ consumer $ fix $ \loop -> join $ lift $ atomically $+ tryTakeTMVar chunk >>= \case+ Just chunk -> return $ L.cons chunk loop+ _ -> readTVar active >>= \case+ False -> return mzero+ _ -> retry atomically $ writeTVar active False putMVar result r catch (C.curl_easy_perform h) $ \case
list-t-libcurl.cabal view
@@ -1,7 +1,7 @@ name: list-t-libcurl version:- 0.2.0.1+ 0.2.0.2 synopsis: A "libcurl"-based streaming HTTP client category: