on master help sign in
Minor tweaks.

--HG-- extra : convert_revision : d403685b77c7a7b0445775fe6e7697814e3d3f89

commit2a768dab2600999b8f83d0fe5ad74f4122446241 authorBryan O'Sullivan <bos@serpentine.com> dateSun 2 May 2010, 17:24 (16 years ago) parent05b6475
1 file changed+2−4
Data/Text/Lazy/Builder.hs+2−4
Data/Text/Lazy/Builder.hs+2−4
@@ -165,9 +165,7 @@ flush = Builder $ \ k buf@(Buffer p o u l) ->
165165
166166-- | Sequence an ST operation on the buffer
167167withBuffer :: (forall s. Buffer s -> ST s (Buffer s)) -> Builder
168−withBuffer f = Builder $ \k buf -> do
169− buf' <- f buf
170− k buf'
168+withBuffer f = Builder $ \k buf -> f buf >>= k
171169{-# INLINE withBuffer #-}
172170
173171-- | Get the size of the buffer
@@ -198,7 +196,7 @@ putChar c
198196
199197-- | Ensure that there are at least @n@ many elements available.
200198ensureFree :: Int -> Builder
201−ensureFree n = n `seq` withSize $ \ l ->
199+ensureFree !n = withSize $ \ l ->
202200 if n <= l
203201 then empty
204202 else flush `append` withBuffer (const (newBuffer (max n defaultChunkSize)))