1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed b68cf65

Another tiny (and probably meaningless) optimization

  • Participants
  • Parent commits 03a9d49
  • Branches default

Comments (0)

Files changed (1)

File Data/Text.hs

View file
                (Text repArr repOff repLen)
       haystack@(Text hayArr hayOff hayLen)
   | neeLen == 0 = emptyError "replace"
+  | L.null ixs  = haystack
+  | len > 0     = Text (A.run x) 0 len
   | len < 0     = overflowError "replace"
-  | len == 0    = empty
-  | L.null ixs  = haystack
-  | otherwise   = Text (A.run x) 0 len
+  | otherwise   = empty
   where
     ixs = indices needle haystack
     len = hayLen - (neeLen - repLen) * L.length ixs