1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed 9bdd685

Rework drop to use the loop we just extracted

  • Participants
  • Parent commits d08eaea
  • Branches default

Comments (0)

Files changed (1)

File Data/Text.hs

View file
 drop n t@(Text arr off len)
     | n <= 0    = t
     | n >= len  = empty
-    | otherwise = loop 0 0
-  where loop !i !cnt
-            | i >= len || cnt >= n   = Text arr (off+i) (len-i)
-            | otherwise              = loop (i+d) (cnt+1)
-            where d = iter_ t i
+    | otherwise = text arr (off+i) (len-i)
+  where i = iterN n t
 {-# INLINE [1] drop #-}
 
 {-# RULES