Skip to content

Commit

Permalink
Fix replaceAll example (#16)
Browse files Browse the repository at this point in the history
Ugh, articles.
  • Loading branch information
meooow25 authored Mar 5, 2024
1 parent df39d31 commit f26a5a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Regex/Internal/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,15 @@ toReplace re = liftA2 f manyListMin re <*> manyList
where
f a b c = concat [a,b,c]

-- | \(O(mn \log m)\). Replace non-overlapping matches of the given @RE@ with
-- their results.
-- | \(O(mn \log m)\). Replace all non-overlapping matches of the given @RE@
-- with their results.
--
-- ==== __Examples__
--
-- >>> replaceAll (" and " <$ list ", ") "red, blue, green"
-- "red and blue and green"
--
-- >>> replaceAll ("Fruit" <$ list "Time" <|> "banana" <$ list "arrow") "Time flies like an arrow"
-- >>> replaceAll ("Fruit" <$ list "Time" <|> "a banana" <$ list "an arrow") "Time flies like an arrow"
-- "Fruit flies like a banana"
--
-- @
Expand Down
6 changes: 3 additions & 3 deletions src/Regex/Internal/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ toReplace re = liftA2 f manyTextMin re <*> manyText
where
f a b c = reverseConcat [c,b,a]

-- | \(O(mn \log m)\). Replace non-overlapping matches of the given @RE@ with
-- their results.
-- | \(O(mn \log m)\). Replace all non-overlapping matches of the given @RE@
-- with their results.
--
-- ==== __Examples__
--
Expand All @@ -511,7 +511,7 @@ toReplace re = liftA2 f manyTextMin re <*> manyText
--
-- For simple replacements like above, prefer @Data.Text.'Data.Text.replace'@.
--
-- >>> replaceAll ("Fruit" <$ text "Time" <|> "banana" <$ text "arrow") "Time flies like an arrow"
-- >>> replaceAll ("Fruit" <$ text "Time" <|> "a banana" <$ text "an arrow") "Time flies like an arrow"
-- "Fruit flies like a banana"
--
-- @
Expand Down

0 comments on commit f26a5a7

Please sign in to comment.