bytebuild 0.3.13.0 → 0.3.14.0
raw patch · 3 files changed
+27/−6 lines, 3 filesdep ~basedep ~natural-arithmeticdep ~primitivePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, natural-arithmetic, primitive, primitive-checked, primitive-unlifted, run-st
API changes (from Hackage documentation)
+ Data.Bytes.Builder: runOntoLength :: Int -> Builder -> Chunks -> (Int, Chunks)
Files
- CHANGELOG.md +5/−0
- bytebuild.cabal +4/−5
- src/Data/Bytes/Builder.hs +18/−1
CHANGELOG.md view
@@ -5,6 +5,11 @@ `small-bytearray-builder` is now just a compatibility shim to ease the migration process. +## 0.3.14.0 -- 2023-07-20++* Add `runOntoLength`.+* Allow building with GHC 9.6.+ ## 0.3.13.0 -- 2023-05-01 * Add VLQ builders for Word32 and Word64.
bytebuild.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: bytebuild-version: 0.3.13.0+version: 0.3.14.0 synopsis: Build byte arrays description: This is similar to the builder facilities provided by@@ -49,15 +49,14 @@ reexported-modules: Data.Bytes.Chunks build-depends:- , base >=4.12.0.0 && <4.18+ , base >=4.12.0.0 && <4.19 , byteslice >=0.2.6 && <0.3 , bytestring >=0.10.8.2 && <0.12 , haskell-src-meta >=0.8 , integer-logarithms >=1.0.3 && <1.1- , natural-arithmetic >=0.1 && <0.2+ , natural-arithmetic >=0.1 && <0.3 , primitive-offset >=0.2 && <0.3- , primitive-unlifted >=0.1.2 && <0.2- , run-st >=0.1 && <0.2+ , run-st >=0.1.2 && <0.2 , template-haskell >=2.16 , text >=1.2 && <2.2 , text-short >=0.1.3 && <0.2
src/Data/Bytes/Builder.hs view
@@ -17,6 +17,7 @@ -- * Evaluation , run , runOnto+ , runOntoLength , reversedOnto , putMany , putManyConsLength@@ -211,7 +212,7 @@ runOnto :: Int -- ^ Size of initial chunk (use 4080 if uncertain) -> Builder -- ^ Builder- -> Chunks+ -> Chunks -- ^ Suffix -> Chunks runOnto hint@(I# hint# ) (Builder f) cs0 = runST $ do MutableByteArray buf0 <- PM.newByteArray hint@@ -219,6 +220,22 @@ (# s1, bufX, offX, _, csX #) -> (# s1, Mutable bufX offX csX #) reverseCommitsOntoChunks cs0 cs++-- | Variant of 'runOnto' that additionally returns the number of bytes+-- consed onto the suffix.+runOntoLength ::+ Int -- ^ Size of initial chunk (use 4080 if uncertain)+ -> Builder -- ^ Builder+ -> Chunks -- ^ Suffix+ -> (Int,Chunks)+runOntoLength hint@(I# hint# ) (Builder f) cs0 = runST $ do+ MutableByteArray buf0 <- PM.newByteArray hint+ cs <- ST $ \s0 -> case f buf0 0# hint# Initial s0 of+ (# s1, bufX, offX, _, csX #) ->+ (# s1, Mutable bufX offX csX #)+ let !n = addCommitsLength 0 cs+ ch <- reverseCommitsOntoChunks cs0 cs+ pure (n,ch) -- | Variant of 'runOnto' that conses the additional chunks -- in reverse order.