On Thu, Jul 19, 2012 at 06:45:05PM +0530, Sai Hemanth K wrote:
> gettext =  (many1 $ noneOf "><") >>= (return . Body)

You can simplify this to:


    import Control.Applicative hiding ((<|>))

    gettext = Body <$> many1 (noneOf "><")


And some of your other parsers can be simplified as well:

    innerXML = xml <|> gettext

    openTag :: Parser String
    openTag = char '<' *> many (noneOf ">") <* char '>'

    endTag :: String -> Parser String
    endTag str = string "</" *> string str <* char '>'

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to