on master help sign in
Minor tweaks.
2a768daBryan O'Sullivan
Data/Text/Lazy/Builder.hs+2−4
@@ -165,9 +165,7 @@ flush = Builder $ \ k buf@(Buffer p o u l) ->
165
165
166-- | Sequence an ST operation on the buffer
166-- | Sequence an ST operation on the buffer
167withBuffer :: (forall s. Buffer s -> ST s (Buffer s)) -> Builder
167withBuffer :: (forall s. Buffer s -> ST s (Buffer s)) -> Builder
168−withBuffer f = Builder $ \k buf -> do
168+withBuffer f = Builder $ \k buf -> f buf >>= k
169− buf' <- f buf
170− k buf'
171{-# INLINE withBuffer #-}
169{-# INLINE withBuffer #-}
172
170
173-- | Get the size of the buffer
171-- | Get the size of the buffer
@@ -198,7 +196,7 @@ putChar c
198
196
199-- | Ensure that there are at least @n@ many elements available.
197-- | Ensure that there are at least @n@ many elements available.
200ensureFree :: Int -> Builder
198ensureFree :: Int -> Builder
201−ensureFree n = n `seq` withSize $ \ l ->
199+ensureFree !n = withSize $ \ l ->
202 if n <= l
200 if n <= l
203 then empty
201 then empty
204 else flush `append` withBuffer (const (newBuffer (max n defaultChunkSize)))
202 else flush `append` withBuffer (const (newBuffer (max n defaultChunkSize)))