polysoup-0.5.1: Online XML parsing with polyparse and tagsoup

Safe HaskellSafe-Inferred

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])
 

Instances

Monad (P a) 
Functor (P a) 
Applicative (P a) 
Alternative (P a) 

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

Evaluate parser on the given XML forest.

Parsing

Selective

find :: Q a b -> P a bSource

A synonym to first.

first :: Q a b -> P a bSource

Find the first tree satisfying the given predicate.

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

Select every tree satisfying the given predicate.

Sequential

pop :: Q a b -> P a bSource

Check, if the first tree satisfies the given predicate.

Peek

peek :: Q a b -> P a bSource

Like pop, but doesn't consume the tree.

spy :: Q a b -> P a bSource

Like first, but doesn't consume the tree.

Utilities

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

Many combinator which ignores parsing results.