@@ -156,11 +156,11 @@ flush = Builder $ \ k buf@(Buffer p o u l) ->
156------------------------------------------------------------------------
156------------------------------------------------------------------------
158-- | Sequence an ST operation on the buffer
158-- | Sequence an ST operation on the buffer
159−unsafeLiftST :: (forall s. Buffer s -> ST s (Buffer s)) -> Builder
159+withBuffer :: (forall s. Buffer s -> ST s (Buffer s)) -> Builder
160−unsafeLiftST f = Builder $ \k buf -> inlineInterleaveST $ do
160+withBuffer f = Builder $ \k buf -> do
161 buf' <- f buf
161 buf' <- f buf
163−{-# INLINE unsafeLiftST #-}
163+{-# INLINE withBuffer #-}
165-- | Get the size of the buffer
165-- | Get the size of the buffer
166withSize :: (Int -> Builder) -> Builder
166withSize :: (Int -> Builder) -> Builder
@@ -193,13 +193,13 @@ ensureFree :: Int -> Builder
193ensureFree n = n `seq` withSize $ \ l ->
193ensureFree n = n `seq` withSize $ \ l ->
194 if n <= l
194 if n <= l
195 then empty
195 then empty
196− else flush `append` unsafeLiftST (const (newBuffer (max n defaultChunkSize)))
196+ else flush `append` withBuffer (const (newBuffer (max n defaultChunkSize)))
197{-# INLINE ensureFree #-}
197{-# INLINE ensureFree #-}
199-- | Ensure that @n@ many elements are available, and then use @f@ to
199-- | Ensure that @n@ many elements are available, and then use @f@ to
200-- write some elements into the memory.
200-- write some elements into the memory.
201writeN :: Int -> (forall s. A.MArray s Word16 -> Int -> ST s ()) -> Builder
201writeN :: Int -> (forall s. A.MArray s Word16 -> Int -> ST s ()) -> Builder
202−writeN n f = ensureFree 1 `append` unsafeLiftST (writeNBuffer n f)
202+writeN n f = ensureFree 1 `append` withBuffer (writeNBuffer n f)
203{-# INLINE writeN #-}
203{-# INLINE writeN #-}
205writeNBuffer :: Int -> (A.MArray s Word16 -> Int -> ST s ()) -> (Buffer s)
205writeNBuffer :: Int -> (A.MArray s Word16 -> Int -> ST s ()) -> (Buffer s)