@@ -621,10 +621,10 @@ replace needle@(Text _ _ neeLen)
621 (Text repArr repOff repLen)
621 (Text repArr repOff repLen)
622 haystack@(Text hayArr hayOff hayLen)
622 haystack@(Text hayArr hayOff hayLen)
623 | neeLen == 0 = emptyError "replace"
623 | neeLen == 0 = emptyError "replace"
624− | len < 0 = overflowError "replace"
626 | L.null ixs = haystack
624 | L.null ixs = haystack
627− | otherwise = Text (A.run x) 0 len
625+ | len > 0 = Text (A.run x) 0 len
626+ | len < 0 = overflowError "replace"
629 ixs = indices needle haystack
629 ixs = indices needle haystack
630 len = hayLen - (neeLen - repLen) * L.length ixs
630 len = hayLen - (neeLen - repLen) * L.length ixs