pipes-bytestring 2.1.0 → 2.1.1
raw patch · 2 files changed
+19/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Pipes.ByteString: hGetNonBlocking :: MonadIO m => Int -> Handle -> Producer' ByteString m ()
Files
- pipes-bytestring.cabal +1/−1
- src/Pipes/ByteString.hs +18/−2
pipes-bytestring.cabal view
@@ -1,5 +1,5 @@ Name: pipes-bytestring -Version: 2.1.0 +Version: 2.1.1 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3
src/Pipes/ByteString.hs view
@@ -55,6 +55,7 @@ , stdin , fromHandle , hGetSome + , hGetNonBlocking , hGet , hGetRange @@ -227,6 +228,23 @@ {-| Convert a handle into a byte stream using a fixed chunk size + Similar to 'hGet' except that it will never block waiting for data + to become available. +-} +hGetNonBlocking :: MonadIO m => Int -> IO.Handle -> Producer' ByteString m () +hGetNonBlocking size h = go where + go = do + eof <- liftIO (IO.hIsEOF h) + if eof + then return () + else do + bs <- liftIO (BS.hGetNonBlocking h size) + yield bs + go +{-# INLINABLE hGetNonBlocking #-} + +{-| Convert a handle into a byte stream using a fixed chunk size + 'hGet' waits until exactly the requested number of bytes are available for each chunk. -} @@ -1000,8 +1018,6 @@ {- $reexports @Data.ByteString@ re-exports the 'ByteString' type. - - @Data.Profunctor@ re-exports the 'Profunctor' type. @Data.Word@ re-exports the 'Word8' type.