@@ -686,9 +686,13 @@ reverse = rev Empty
686686--
687687-- In (unlikely) bad cases, this function's time complexity degrades
688688-- towards /O(n*m)/.
689−replace :: Text -- ^ Text to search for
690− -> Text -- ^ Replacement text
691− -> Text -- ^ Input text
689+replace :: Text
690+ -- ^ @needle@ to search for. If this string is empty, an
691+ -- error will occur.
692+ -> Text
693+ -- ^ @replacement@ to replace @needle@ with.
694+ -> Text
695+ -- ^ @haystack@ in which to search.
692696 -> Text
693697replace s d = intercalate d . splitOn s
694698{-# INLINE replace #-}
@@ -1299,9 +1303,10 @@ tails ts@(Chunk t ts')
12991303-- copies to create substrings; they just construct new 'Text's that
13001304-- are slices of the original.
13011305
1302−-- | /O(m+n)/ Break a 'Text' into pieces separated by the first
1303−-- 'Text' argument, consuming the delimiter. An empty delimiter is
1304−-- invalid, and will cause an error to be raised.
1306+-- | /O(m+n)/ Break a 'Text' into pieces separated by the first 'Text'
1307+-- argument (which cannot be an empty string), consuming the
1308+-- delimiter. An empty delimiter is invalid, and will cause an error
1309+-- to be raised.
13051310--
13061311-- Examples:
13071312--
@@ -1314,13 +1319,18 @@ tails ts@(Chunk t ts')
13141319-- > intercalate s . splitOn s == id
13151320-- > splitOn (singleton c) == split (==c)
13161321--
1322+-- (Note: the string @s@ to split on above cannot be empty.)
1323+--
13171324-- This function is strict in its first argument, and lazy in its
13181325-- second.
13191326--
13201327-- In (unlikely) bad cases, this function's time complexity degrades
13211328-- towards /O(n*m)/.
1322−splitOn :: Text -- ^ Text to split on
1323− -> Text -- ^ Input text
1329+splitOn :: Text
1330+ -- ^ String to split on. If this string is empty, an error
1331+ -- will occur.
1332+ -> Text
1333+ -- ^ Input text.
13241334 -> [Text]
13251335splitOn pat src
13261336 | null pat = emptyError "splitOn"