diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/bytebuild.cabal b/bytebuild.cabal
--- a/bytebuild.cabal
+++ b/bytebuild.cabal
@@ -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
diff --git a/src/Data/Bytes/Builder.hs b/src/Data/Bytes/Builder.hs
--- a/src/Data/Bytes/Builder.hs
+++ b/src/Data/Bytes/Builder.hs
@@ -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.
