-
-
Save tonymorris/80b1b11b31a90ccfdb6bbb4deaa5eea9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | | |
-- | |
-- >>> parse (search (string "abc")) "test" "" | |
-- Right [] | |
-- | |
-- >>> parse (search (string "abc")) "test" " abc def abc " | |
-- Right ["abc","abc"] | |
search :: | |
Stream s m Char => | |
ParsecT s u m a | |
-> ParsecT s u m [a] | |
search p = | |
let ps = search p | |
in (:) <$> try p <*> ps <|> | |
try (anyChar *> ps) <|> | |
pure [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment