1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed 6f4c792

Small tweaklets.

  • Participants
  • Parent commits d108a75
  • Branches default

Comments (0)

Files changed (1)

File Data/Text/Lazy/Builder.hs

View file
  • Ignore whitespace
     if u == 0
         then k buf
         else do arr  <- A.unsafeFreeze p
-                buf' <- inlineInterleaveST (k (Buffer p (o+u) 0 l))
-                return (Text arr o u : buf')
+                let !b = Buffer p (o+u) 0 l
+                    !t = Text arr o u
+                buf' <- inlineInterleaveST (k b)
+                return $! t : buf'
 
 ------------------------------------------------------------------------
 
 
 -- | Map the resulting list of texts.
 mapBuilder :: ([S.Text] -> [S.Text]) -> Builder
-mapBuilder f = Builder $ \ k buf -> do txt <- k buf
-                                       return (f txt)
+mapBuilder f = Builder (fmap f .)
 
 ------------------------------------------------------------------------
 
              -> ST s (Buffer s)
 writeNBuffer n f (Buffer p o u l) = do
     f p (o+u)
-    return (Buffer p o (u+n) (l-n))
+    return $! Buffer p o (u+n) (l-n)
 {-# INLINE writeNBuffer #-}
 
 newBuffer :: Int -> ST s (Buffer s)