>>> many (putStr "la") lalalalalalalalala... * goes on forever *
>>> many Nothing Just []
>>> take 5 <$> many (Just 1) * hangs forever *Note that this function can be used with Parsers based on Applicatives. In that case many parser will attempt to parse parser zero or more times until it fails.
identifier = do{ c <- letter ; cs <- many (alphaNum <|> char '_') ; return (c:cs) }
word = many1 letter
simpleComment = do{ string "<!--" ; manyTill anyChar (try (string "-->")) }Note the overlapping parsers anyChar and string "-->", and therefore the use of the try combinator.
word = many' letter
word = many1 letter
word = many1' letter
simpleComment = string "<!--" *> manyTill anyChar (string "-->")(Note the overlapping parsers anyChar and string "-->". While this will work, it is not very efficient, as it will cause a lot of backtracking.)
simpleComment = string "<!--" *> manyTill' anyChar (string "-->")(Note the overlapping parsers anyChar and string "-->". While this will work, it is not very efficient, as it will cause a lot of backtracking.) The value returned by p is forced to WHNF.