packages feed

hw-prim 0.6.2.10 → 0.6.2.11

raw patch · 2 files changed

+13/−1 lines, 2 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ HaskellWorks.Data.ByteString: hGetContentsChunkedBy :: Int -> Handle -> IO [ByteString]

Files

hw-prim.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           hw-prim-version:        0.6.2.10+version:        0.6.2.11 synopsis:       Primitive functions and data types description:    Primitive functions and data types. category:       Data
src/HaskellWorks/Data/ByteString.hs view
@@ -7,6 +7,7 @@   , resegment   , resegmentPadded   , rechunk+  , hGetContentsChunkedBy   ) where  import Data.Semigroup ((<>))@@ -16,6 +17,8 @@ import qualified Data.ByteString.Internal as BSI import qualified Data.ByteString.Lazy     as LBS import qualified Data.Vector.Storable     as DVS+import qualified System.IO                as IO+import qualified System.IO.Unsafe         as IO  class ToByteString a where   toByteString :: a -> BS.ByteString@@ -148,3 +151,12 @@                     then bs:go bss                     else BS.take bsCroppedLen bs:go (BS.drop bsCroppedLen bs:bss)         go [] = []++hGetContentsChunkedBy :: Int -> IO.Handle -> IO [BS.ByteString]+hGetContentsChunkedBy k h = lazyRead+  where lazyRead = IO.unsafeInterleaveIO loop+        loop = do+            c <- BSI.createAndTrim k $ \p -> IO.hGetBuf h p k+            if BS.null c+              then IO.hClose h >> return []+              else (c:) <$> lazyRead