fix build with old http-conduit

This commit is contained in:
Joey Hess 2018-04-24 21:23:40 -04:00
parent 43b4e80bf5
commit 3c6e60dc69
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -326,10 +326,25 @@ download meterupdate url file uo = go `catchNonAsync` (const $ return False)
-
- Note that the responseStatus is not checked by this function.
-}
sinkResponseFile :: MonadResource m => MeterUpdate -> BytesProcessed -> FilePath -> IOMode -> Response (ConduitM () B8.ByteString m ()) -> m ()
sinkResponseFile
:: MonadResource m
=> MeterUpdate
-> BytesProcessed
-> FilePath
-> IOMode
#if MIN_VERSION_http_conduit(2,3,0)
-> Response (ConduitM () B8.ByteString m ())
#else
-> Response (ResumableSource m B8.ByteString)
#endif
-> m ()
sinkResponseFile meterupdate initialp file mode resp = do
(fr, fh) <- allocate (openBinaryFile file mode) hClose
#if MIN_VERSION_http_conduit(2,3,0)
runConduit $ responseBody resp .| go initialp fh
#else
responseBody resp $$+- go initialp fh
#endif
release fr
where
go sofar fh = await >>= \case