module Exercise04 where import Text.ParserCombinators.ReadP ( ReadP, char, many1, skipSpaces, readP_to_S, satisfy, string, munch1, (<++), eof, skipMany) {-WETT-} skipTagsandPlainText :: ReadP () skipTagsandPlainText = skipMany $ parseTag <++ parsePlain parseTag :: ReadP String parseTag = do _ <- char '<' str <- many1 $ satisfy (`notElem` "<>/ ") skipSpaces _ <- char '>' skipTagsandPlainText _ <- string $ "" parsePlain :: ReadP String parsePlain = munch1 (`notElem` "<>") xmlLightParser :: ReadP () xmlLightParser = do skipTagsandPlainText eof xmlLight :: String -> Bool xmlLight = not . (null . readP_to_S xmlLightParser) {-TTEW-}