diff --git a/.gitignore b/.gitignore index e2d43c9..62df6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ dist +dist-newstyle +*.ghc* cabal-dev *.o *.hi diff --git a/Data/ByteString/Streaming/HTTP.hs b/Data/ByteString/Streaming/HTTP.hs index 7b0b60b..cceecd9 100644 --- a/Data/ByteString/Streaming/HTTP.hs +++ b/Data/ByteString/Streaming/HTTP.hs @@ -1,4 +1,4 @@ -{-#LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedStrings #-} -- | This module replicates `pipes-http` as closely as will type-check, adding a -- conduit-like @http@ in @ResourceT@ and a primitive @simpleHTTP@ that emits -- a streaming bytestring rather than a lazy one. @@ -38,7 +38,7 @@ -- > import Data.ByteString.Streaming.HTTP -- > -- > main = do --- > req <- parseUrl "https://www.example.com" +-- > req <- parseUrlThrow "https://www.example.com" -- > m <- newManager tlsManagerSettings -- > runResourceT $ do -- > resp <- http request manager @@ -205,7 +205,7 @@ import Data.ByteString.Streaming.HTTP simpleHTTP :: MonadResource m => String -> ByteString m () simpleHTTP url = do man <- liftIO (newManager tlsManagerSettings) - req <- liftIO (parseUrl url) + req <- liftIO (parseUrlThrow url) bracketByteString (responseOpen req man) responseClose diff --git a/Streaming/Zip.hs b/Streaming/Zip.hs index ebfebdf..7523316 100644 --- a/Streaming/Zip.hs +++ b/Streaming/Zip.hs @@ -4,6 +4,7 @@ module Streaming.Zip ( -- * Streams decompress , decompress' + , decompressAll , compress , gunzip , gunzip' @@ -83,6 +84,14 @@ decompress' wbits p0 = go p0 =<< liftIO (Z.initInflate wbits) else return $ Left (chunk leftover >> p') {-# INLINABLE decompress' #-} +-- | Keep decompressing a compressed bytestream until exhausted. +decompressAll :: MonadIO m => Z.WindowBits -> ByteString m r -> ByteString m r +decompressAll w bs = decompress' w bs >>= go + where + go (Left bs) = decompress' w bs >>= go + go (Right r) = return r +{-# INLINABLE decompressAll #-} + -- | Compress a byte stream. -- -- See the "Codec.Compression.Zlib" module for details about diff --git a/nix-ci-ish.sh b/nix-ci-ish.sh new file mode 100644 index 0000000..ad4b62b --- /dev/null +++ b/nix-ci-ish.sh @@ -0,0 +1,6 @@ +nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs-channels/archive/nixos-17.09.tar.gz -p haskell.compiler.ghc7103 --run "cabal new-build" +nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs-channels/archive/nixos-17.09.tar.gz -p haskell.compiler.ghc802 --run "cabal new-build" +nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs-channels/archive/nixos-18.09.tar.gz -p haskell.compiler.ghc822 --run "cabal new-build" +nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs-channels/archive/nixos-18.09.tar.gz -p haskell.compiler.ghc844 --run "cabal new-build" +nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs-channels/archive/nixos-18.09.tar.gz -p haskell.compiler.ghc862 --run "cabal new-build" + diff --git a/streaming-utils.cabal b/streaming-utils.cabal index 24ca383..9c8cb84 100644 --- a/streaming-utils.cabal +++ b/streaming-utils.cabal @@ -1,5 +1,5 @@ name: streaming-utils -version: 0.1.4.7 +version: 0.2.0.0 synopsis: http, attoparsec, pipes and other utilities for the streaming libraries description: This package includes http-client, aeson, attoparsec, zlib and pipes utilities for use with @@ -39,16 +39,15 @@ description: This package includes http-client, aeson, attoparsec, zlib license: BSD3 license-file: LICENSE author: michaelt -maintainer: what_is_it_to_do_anything@yahoo.com +maintainer: chessai1996@gmail.com -- copyright: -category: Data build-type: Simple +category: Data, Pipes, Streaming -- extra-source-files: cabal-version: >=1.10 stability: Experimental homepage: https://github.com/michaelt/streaming-utils bug-reports: https://github.com/michaelt/streaming-utils/issues -category: Data, Pipes, Streaming source-repository head type: git location: https://github.com/michaelt/streaming-utils @@ -64,22 +63,23 @@ library -- other-modules: other-extensions: CPP, Trustworthy - build-depends: base >=4.7 && <5.0, - transformers >=0.4 && <0.5.3, + build-depends: base >=4.8 && <5.0, + transformers >=0.4 && <0.6, mtl >=2.2 && <2.3, - attoparsec > 0.13.0.0 && < 0.13.2.0, - streaming >= 0.1.4.0 && < 0.1.4.8, - streaming-bytestring >= 0.1.4.0 && < 0.1.4.8, - bytestring > 0.10.0 && < 0.11.0, + attoparsec > 0.13.0.0 && < 0.14, + streaming >= 0.2 && < 0.3, + streaming-bytestring >= 0.1 && < 0.2, + bytestring > 0.10 && < 0.11, pipes >= 4.0 && < 4.4, network-simple, network, - http-client >=0.2 && <0.6, + http-client >=0.2 && <0.7, http-client-tls, - aeson > 0.8 && <1.2, - json-stream > 0.4.0 && < 0.4.2, - resourcet > 1.0 && < 1.2, - streaming-commons > 0.1.0 && < 0.1.18 - + aeson > 0.8 && <1.6, + json-stream > 0.4 && < 0.5, + resourcet > 1.0 && < 1.3, + streaming-commons > 0.2 && < 0.3 + + pkgconfig-depends: zlib -- hs-source-dirs: default-language: Haskell2010