Commits

Bryan O'Sullivan committed a5bb6a8

Use unsafeTail in a few places, for speed

  • Participants
  • Parent commits c3ad48e

Comments (0)

Files changed (1)

 -- first.
 tails :: Text -> [Text]
 tails t | null t    = [empty]
-        | otherwise = t : tails (tail t)
+        | otherwise = t : tails (unsafeTail t)
 
 -- | /O(n)/ Break a 'Text' into pieces separated by the 'Char'
 -- argument, consuming the delimiter. I.e.
     search !n !s
         | null s             = (src,empty)      -- not found
         | pat `isPrefixOf` s = (take n src,s)
-        | otherwise          = search (n+1) (tail s)
+        | otherwise          = search (n+1) (unsafeTail s)
 {-# INLINE breakSubstring #-}
 
 -- | /O(n)/ 'filter', applied to a predicate and a 'Text',