@@ -689,9 +689,13 @@ reverse t = S.reverse (stream t)
690-- In (unlikely) bad cases, this function's time complexity degrades
690-- In (unlikely) bad cases, this function's time complexity degrades
691-- towards /O(n*m)/.
691-- towards /O(n*m)/.
692−replace :: Text -- ^ @needle@ to search for
692+replace :: Text
693+ -- ^ @needle@ to search for. If this string is empty, an
694+ -- error will occur.
693− -> Text -- ^ @replacement@ to replace @needle@ with
696+ -- ^ @replacement@ to replace @needle@ with.
694− -> Text -- ^ @haystack@ in which to search
698+ -- ^ @haystack@ in which to search.
696replace needle@(Text _ _ neeLen)
700replace needle@(Text _ _ neeLen)
697 (Text repArr repOff repLen)
701 (Text repArr repOff repLen)
@@ -1299,9 +1303,9 @@ tails t | null t = [empty]
1299-- copies to create substrings; they just construct new 'Text's that
1303-- copies to create substrings; they just construct new 'Text's that
1300-- are slices of the original.
1304-- are slices of the original.
1302−-- | /O(m+n)/ Break a 'Text' into pieces separated by the first
1306+-- | /O(m+n)/ Break a 'Text' into pieces separated by the first 'Text'
1303−-- 'Text' argument, consuming the delimiter. An empty delimiter is
1307+-- argument (which cannot be empty), consuming the delimiter. An empty
1304−-- invalid, and will cause an error to be raised.
1308+-- delimiter is invalid, and will cause an error to be raised.
1306-- Examples:
1310-- Examples:
@@ -1314,9 +1318,16 @@ tails t | null t = [empty]
1314-- > intercalate s . splitOn s == id
1318-- > intercalate s . splitOn s == id
1315-- > splitOn (singleton c) == split (==c)
1319-- > splitOn (singleton c) == split (==c)
1321+-- (Note: the string @s@ to split on above cannot be empty.)
1317-- In (unlikely) bad cases, this function's time complexity degrades
1323-- In (unlikely) bad cases, this function's time complexity degrades
1318-- towards /O(n*m)/.
1324-- towards /O(n*m)/.
1319−splitOn :: Text -> Text -> [Text]
1325+splitOn :: Text
1326+ -- ^ String to split on. If this string is empty, an error
1320splitOn pat@(Text _ _ l) src@(Text arr off len)
1331splitOn pat@(Text _ _ l) src@(Text arr off len)
1321 | l <= 0 = emptyError "splitOn"
1332 | l <= 0 = emptyError "splitOn"
1322 | isSingleton pat = split (== unsafeHead pat) src
1333 | isSingleton pat = split (== unsafeHead pat) src