polysoup-0.6.2: Online XML parsing with polyparse and tagsoup

Safe HaskellSafe
LanguageHaskell98

Text.XML.PolySoup.Parser

Contents

Description

The module defines a generic parser which can be used, in particular, to parse XML forests. The main characteristic of the parser is that it can be used in a sequential (sub-trees are processed in order) and a selective (subtrees are process regardless of their position) way.

Synopsis

Core

newtype P a b Source

An XML forest parser.

Constructors

P 

Fields

runP :: [a] -> Maybe (b, [a])
 

evalP :: P a b -> [a] -> Maybe b Source

Evaluate parser on the given XML forest.

Parsing

Selective

first :: Q a b -> P a b Source

Find the first tree satisfying the given predicate.

every :: Q a b -> P a [b] Source

Select every tree satisfying the given predicate.

every' :: Q a b -> P a [b] Source

A lazy version of every which "forgets" non-matching subtrees along the way.

Sequential

pop :: Q a b -> P a b Source

Check, if the first tree satisfies the given predicate.

Peek

peek :: Q a b -> P a b Source

Like pop, but doesn't consume the tree.

spy :: Q a b -> P a b Source

Like first, but doesn't consume the tree.

Utilities

many_ :: Alternative f => f a -> f () Source

Many combinator which ignores parsing results.