[remove haddock-generated docs from repo
Malcolm.Wallace@cs.york.ac.uk**20060131152213] {
hunk ./docs/HaXml/Text.ParserCombinators.HuttonMeijerWallace.html 1
-
-
-
|
Text.ParserCombinators.HuttonMeijerWallace |
|
|
|
Contents |
- The parser monad
- Primitive parser combinators
- Derived combinators
- Error handling
- State handling
- Re-parsing
|
|
Description |
This library of monadic parser combinators is based on the ones
- defined by Graham Hutton and Erik Meijer. It has been extended by
- Malcolm Wallace to use an abstract token type (no longer just a
- string) as input, and to incorporate a State Transformer monad, useful
- for symbol tables, macros, and so on. Basic facilities for error
- reporting have also been added, and later extended by Graham Klyne
- to return the errors through an Either type, rather than just
- calling error. |
|
Synopsis |
|
data Parser s t e a = P (s -> [Either e t] -> ParseResult s t e a) | | item :: Parser s t e t | | eof :: (Show p) => Parser s (p, t) String () | | papply :: Parser s t String a -> s -> [Either String t] -> [(a, s, [Either String t])] | | papply' :: Parser s t e a -> s -> [Either e t] -> Either e [(a, s, [Either e t])] | | (+++) :: Parser s t e a -> Parser s t e a -> Parser s t e a | | tok :: (Eq t) => t -> Parser s (p, t) e t | | nottok :: (Eq t) => [t] -> Parser s (p, t) e t | | many :: Parser s t e a -> Parser s t e [a] | | many1 :: Parser s t e a -> Parser s t e [a] | | sepby :: Parser s t e a -> Parser s t e b -> Parser s t e [a] | | sepby1 :: Parser s t e a -> Parser s t e b -> Parser s t e [a] | | chainl :: Parser s t e a -> Parser s t e (a -> a -> a) -> a -> Parser s t e a | | chainl1 :: Parser s t e a -> Parser s t e (a -> a -> a) -> Parser s t e a | | chainr :: Parser s t e a -> Parser s t e (a -> a -> a) -> a -> Parser s t e a | | chainr1 :: Parser s t e a -> Parser s t e (a -> a -> a) -> Parser s t e a | | ops :: [(Parser s t e a, b)] -> Parser s t e b | | bracket :: (Show p, Show t) => Parser s (p, t) e a -> Parser s (p, t) e b -> Parser s (p, t) e c -> Parser s (p, t) e b | | toEOF :: (Show p) => Parser s (p, t) String a -> Parser s (p, t) String a | | elserror :: (Show p, Show t) => Parser s (p, t) String a -> String -> Parser s (p, t) String a | | stupd :: (s -> s) -> Parser s t e () | | stquery :: (s -> a) -> Parser s t e a | | stget :: Parser s t e s | | reparse :: [Either e t] -> Parser s t e () |
|
|
|
The parser monad |
|
data Parser s t e a |
Constructors | P (s -> [Either e t] -> ParseResult s t e a) | The parser type is parametrised on the types of the state s,
- the input tokens t, error-type e, and the result value a.
- The state and remaining input are threaded through the monad. |
| Instances | |
|
|
Primitive parser combinators |
|
item :: Parser s t e t |
Deliver the first remaining token. |
|
eof :: (Show p) => Parser s (p, t) String () |
Fail if end of input is not reached |
|
papply :: Parser s t String a -> s -> [Either String t] -> [(a, s, [Either String t])] |
Apply the parser to some real input, given an initial state value.
- If the parser fails, raise error to halt the program.
- (This is the original exported behaviour - to allow the caller to
- deal with the error differently, see papply'.) |
|
papply' :: Parser s t e a -> s -> [Either e t] -> Either e [(a, s, [Either e t])] |
Apply the parser to some real input, given an initial state value.
- If the parser fails, return a diagnostic message to the caller. |
|
Derived combinators |
|
(+++) :: Parser s t e a -> Parser s t e a -> Parser s t e a |
A choice between parsers. Keep only the first success. |
|
tok :: (Eq t) => t -> Parser s (p, t) e t |
Deliver the first token if it equals the argument. |
|
nottok :: (Eq t) => [t] -> Parser s (p, t) e t |
Deliver the first token if it does not equal the argument. |
|
many :: Parser s t e a -> Parser s t e [a] |
Deliver zero or more values of a. |
|
many1 :: Parser s t e a -> Parser s t e [a] |
Deliver one or more values of a. |
|
sepby :: Parser s t e a -> Parser s t e b -> Parser s t e [a] |
Deliver zero or more values of a separated by b's. |
|
sepby1 :: Parser s t e a -> Parser s t e b -> Parser s t e [a] |
Deliver one or more values of a separated by b's. |
|
chainl :: Parser s t e a -> Parser s t e (a -> a -> a) -> a -> Parser s t e a |
|
chainl1 :: Parser s t e a -> Parser s t e (a -> a -> a) -> Parser s t e a |
|
chainr :: Parser s t e a -> Parser s t e (a -> a -> a) -> a -> Parser s t e a |
|
chainr1 :: Parser s t e a -> Parser s t e (a -> a -> a) -> Parser s t e a |
|
ops :: [(Parser s t e a, b)] -> Parser s t e b |
|
bracket :: (Show p, Show t) => Parser s (p, t) e a -> Parser s (p, t) e b -> Parser s (p, t) e c -> Parser s (p, t) e b |
|
toEOF :: (Show p) => Parser s (p, t) String a -> Parser s (p, t) String a |
Accept a complete parse of the input only, no partial parses. |
|
Error handling |
|
elserror :: (Show p, Show t) => Parser s (p, t) String a -> String -> Parser s (p, t) String a |
If the parser fails, generate an error message. |
|
State handling |
|
stupd :: (s -> s) -> Parser s t e () |
Update the internal state. |
|
stquery :: (s -> a) -> Parser s t e a |
Query the internal state. |
|
stget :: Parser s t e s |
Deliver the entire internal state. |
|
Re-parsing |
|
reparse :: [Either e t] -> Parser s t e () |
This is useful for recursively expanding macros. When the
- user-parser recognises a macro use, it can lookup the macro
- expansion from the parse state, lex it, and then stuff the
- lexed expansion back down into the parser. |
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.ParserCombinators.HuttonMeijerWallace.html
hunk ./docs/HaXml/Text.PrettyPrint.HughesPJ.html 1
-
-
- |
Text.XML.HaXml.Combinators |
|
|
|
Contents |
- The content filter type.
- Simple filters.
- Selection filters.
- Predicate filters.
- Search filters.
- Filter combinators
- Basic combinators.
- Recursive search.
- Interior editing.
- Constructive filters.
- C-like conditionals.
- Filters with labelled results.
- Using and combining labelled filters.
- Some label-generating filters.
|
|
Description |
This module defines the notion of filters and filter combinators
- for processing XML documents. These XML transformation combinators are described in the paper
- ``Haskell and XML: Generic Combinators or Type-Based Translation?''
- Malcolm Wallace and Colin Runciman, Proceedings ICFP'99. |
|
Synopsis |
|
|
|
|
The content filter type. |
|
type CFilter = Content -> [Content] |
All document transformations are content filters.
- A filter takes a single XML Content value and returns a sequence
- of Content values, possibly empty. |
|
Simple filters. |
|
Selection filters. |
|
In the algebra of combinators, none is the zero, and keep the identity.
- (They have a more general type than just CFilter.) |
|
keep :: a -> [a] |
|
none :: a -> [a] |
|
children :: CFilter |
Throw away current node, keep just the (unprocessed) children. |
|
position :: Int -> CFilter -> CFilter |
Select the n'th positional result of a filter. |
|
Predicate filters. |
|
These filters either keep or throw away some content based on
- a simple test. For instance, elm keeps only a tagged element,
- txt keeps only non-element text, tag keeps only an element
- with the named tag, attr keeps only an element with the named
- attribute, attrval keeps only an element with the given
- attribute value, tagWith keeps only an element whose tag name
- satisfies the given predicate. |
|
elm :: CFilter |
|
txt :: CFilter |
|
tag :: String -> CFilter |
|
attr :: Name -> CFilter |
|
attrval :: Attribute -> CFilter |
|
tagWith :: (String -> Bool) -> CFilter |
|
Search filters. |
|
find :: String -> (String -> CFilter) -> CFilter |
For a mandatory attribute field, find key cont looks up the value of
- the attribute name key, and applies the continuation cont to
- the value. |
|
iffind :: String -> (String -> CFilter) -> CFilter -> CFilter |
When an attribute field may be absent, use iffind key yes no to lookup
- its value. If the attribute is absent, it acts as the no filter,
- otherwise it applies the yes filter. |
|
ifTxt :: (String -> CFilter) -> CFilter -> CFilter |
ifTxt yes no processes any textual content with the yes filter,
- but otherwise is the same as the no filter. |
|
Filter combinators |
|
Basic combinators. |
|
o :: CFilter -> CFilter -> CFilter |
Sequential (Irish,backwards) composition |
|
union :: (a -> [b]) -> (a -> [b]) -> a -> [b] |
Binary parallel composition. Each filter uses a copy of the input,
- rather than one filter using the result of the other.
- (Has a more general type than just CFilter.) |
|
cat :: [a -> [b]] -> a -> [b] |
Glue a list of filters together. (A list version of union;
- also has a more general type than just CFilter.) |
|
andThen :: (a -> c) -> (c -> a -> b) -> a -> b |
A special form of filter composition where the second filter
- works over the same data as the first, but also uses the
- first's result. |
|
(|>|) :: (a -> [b]) -> (a -> [b]) -> a -> [b] |
Directional choice:
- in f |>| g give g-productions only if no f-productions |
|
with :: CFilter -> CFilter -> CFilter |
Pruning: in f with g,
- keep only those f-productions which have at least one g-production |
|
without :: CFilter -> CFilter -> CFilter |
Pruning: in f without g,
- keep only those f-productions which have no g-productions |
|
(/>) :: CFilter -> CFilter -> CFilter |
Pronounced slash, f /> g means g inside f |
|
(</) :: CFilter -> CFilter -> CFilter |
Pronounced outside, f </ g means f containing g |
|
et :: (String -> CFilter) -> CFilter -> CFilter |
Join an element-matching filter with a text-only filter |
|
path :: [CFilter] -> CFilter |
Express a list of filters like an XPath query, e.g.
- path [children, tag "name1", attr "attr1", children, tag "name2"]
- is like the XPath query /name1[@attr1]/name2. |
|
Recursive search. |
|
Recursive search has three variants: deep does a breadth-first
- search of the tree, deepest does a depth-first search, multi returns
- content at all tree-levels, even those strictly contained within results
- that have already been returned. |
|
deep :: CFilter -> CFilter |
|
deepest :: CFilter -> CFilter |
|
multi :: CFilter -> CFilter |
|
Interior editing. |
|
when :: CFilter -> CFilter -> CFilter |
Interior editing:
- f when g applies f only when the predicate g succeeds,
- otherwise the content is unchanged. |
|
guards :: CFilter -> CFilter -> CFilter |
Interior editing:
- g guards f applies f only when the predicate g succeeds,
- otherwise the content is discarded. |
|
chip :: CFilter -> CFilter |
Process CHildren In Place. The filter is applied to any children
- of an element content, and the element rebuilt around the results. |
|
foldXml :: CFilter -> CFilter |
Recursive application of filters: a fold-like operator. Defined
- as f o chip (foldXml f). |
|
Constructive filters. |
|
mkElem :: String -> [CFilter] -> CFilter |
Build an element with the given tag name - its content is the results
- of the given list of filters. |
|
mkElemAttr :: String -> [(String, CFilter)] -> [CFilter] -> CFilter |
Build an element with the given name, attributes, and content. |
|
literal :: String -> CFilter |
Build some textual content. |
|
cdata :: String -> CFilter |
Build some CDATA content. |
|
replaceTag :: String -> CFilter |
Rename an element tag. |
|
replaceAttrs :: [(String, String)] -> CFilter |
Replace the attributes of an element. |
|
C-like conditionals. |
|
These definitions provide C-like conditionals, lifted to the filter level. The (cond ? yes : no) style in C becomes (cond ?> yes :> no) in Haskell. |
|
data ThenElse a |
Conjoin the two branches of a conditional. | Constructors | |
|
|
(?>) :: (a -> [b]) -> ThenElse (a -> [b]) -> a -> [b] |
Select between the two branches of a joined conditional. |
|
Filters with labelled results. |
|
type LabelFilter a = Content -> [(a, Content)] |
A LabelFilter is like a CFilter except that it pairs up a polymorphic
- value (label) with each of its results. |
|
Using and combining labelled filters. |
|
oo :: (a -> CFilter) -> LabelFilter a -> CFilter |
Compose a label-processing filter with a label-generating filter. |
|
x :: (CFilter -> LabelFilter a) -> (CFilter -> LabelFilter b) -> CFilter -> LabelFilter (a, b) |
Combine labels. Think of this as a pair-wise zip on labels. |
|
Some label-generating filters. |
|
numbered :: CFilter -> LabelFilter String |
Number the results from 1 upwards. |
|
interspersed :: String -> CFilter -> String -> LabelFilter String |
In interspersed a f b, label each result of f with the string a,
- except for the last one which is labelled with the string b. |
|
tagged :: CFilter -> LabelFilter String |
Label each element in the result with its tag name. Non-element
- results get an empty string label. |
|
attributed :: String -> CFilter -> LabelFilter String |
Label each element in the result with the value of the named attribute.
- Elements without the attribute, and non-element results, get an
- empty string label. |
|
textlabelled :: CFilter -> LabelFilter (Maybe String) |
Label each textual part of the result with its text. Element
- results get an empty string label. |
|
extracted :: (Content -> a) -> CFilter -> LabelFilter a |
Label each content with some information extracted from itself. |
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.Combinators.html
hunk ./docs/HaXml/Text.XML.HaXml.DtdToHaskell.Convert.html 1
-
-
- |
Text.XML.HaXml.DtdToHaskell.TypeDef |
|
|
|
Contents |
- Internal representation of types
- Pretty-print a TypeDef
- Name mangling
|
|
Description |
Defines an internal representation of Haskell data/newtype definitions
- that correspond to the XML DTD types, and provides pretty-printers to
- convert these types into the Doc type of Text.PrettyPrint.HughesPJ. |
|
Synopsis |
|
|
|
|
Internal representation of types |
|
data TypeDef |
|
|
type Constructors = [(Name, [StructType])] |
|
type AttrFields = [(Name, StructType)] |
|
data StructType |
|
|
Pretty-print a TypeDef |
|
ppTypeDef :: TypeDef -> Doc |
|
ppHName :: Name -> Doc |
Pretty print Haskell name. |
|
ppXName :: Name -> Doc |
Pretty print XML name. |
|
ppAName :: Name -> Doc |
Pretty print Haskell attributes name. |
|
Name mangling |
|
data Name |
Need to keep both the XML and Haskell versions of a name. | Constructors | Name | | xName :: String | original XML name | hName :: String | mangled Haskell name |
|
|
|
|
name :: String -> Name |
Make a name valid in both XML and Haskell. |
|
name_ :: String -> Name |
Append an underscore to the Haskell version of the name. |
|
name_a :: String -> String -> Name |
Prefix an attribute enumeration type name with its containing element
- name. |
|
name_ac :: String -> String -> String -> Name |
Prefix an attribute enumeration constructor with its element-tag name,
- and its enumeration type name. |
|
name_f :: String -> String -> Name |
Prefix a field name with its enclosing element name. |
|
mangle :: String -> String |
Convert an XML name to a Haskell conid. |
|
manglef :: String -> String |
Convert an XML name to a Haskell varid. |
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.DtdToHaskell.TypeDef.html
hunk ./docs/HaXml/Text.XML.HaXml.Escape.html 1
-
-
- |
Text.XML.HaXml.Haskell2Xml |
|
|
|
Contents |
- Re-export the entire set of XML type definitions
- The class Haskell2Xml
- Conversion functions
- IO conversion functions
- Auxiliary types
|
|
Description |
The class Haskell2Xml is a replacement for Read and Show: it provides
- textual conversions (to and from an XML representation) for your
- Haskell data values. Use the tool
- DrIFT to derive this class for your own datatypes, then
- include this module where you want to use the facilities. The methods toContents and fromContents convert a value to and from
- a generic internal representation of an XML document without a DTD.
- The functions toXml and fromXml convert a value to and from a generic
- internal representation of an XML document including a DTD.
- The functions readXml and showXml convert to and from Strings.
- The functions fReadXml and fWriteXml do the conversion to and from
- the given filenames.
- The functions hGetXml and hPutXml do the conversion to and from
- the given file handles.
- (See the type signatures.) |
|
Synopsis |
|
|
|
|
Re-export the entire set of XML type definitions |
|
module Text.XML.HaXml.Types |
|
The class Haskell2Xml |
|
class Haskell2Xml a where |
A class to convert any Haskell value to and from an XML representation. | | Methods | xFromChar :: Char -> a | | xToChar :: a -> Char | | fromContents :: [Content] -> (a, [Content]) | This function is a dummy for most types: it is used only in
- the Char instance for coercing lists of Char into String. | | toContents :: a -> [Content] | Parse a Haskell value from a generic XML representation, returning
- the value and the remainder of the XML. | | toHType :: a -> HType | Convert the Haskell value to a generic XML value. |
| | Instances | |
|
|
Conversion functions |
|
toXml :: (Haskell2Xml a) => a -> Document |
Convert any Haskell value to an XML document, including both DTD and
- content. |
|
toDTD :: HType -> DocTypeDecl |
toDTD converts a concrete representation of the Haskell type of
- a value (obtained by the method toHType) into a real DocTypeDecl.
- It ensures that PERefs are defined before they are used, and that no
- element or attribute-list is declared more than once. |
|
fromXml :: (Haskell2Xml a) => Document -> a |
Read a Haskell value from an XML document, ignoring the DTD and
- using the Haskell result type to determine how to parse it. |
|
readXml :: (Haskell2Xml a) => String -> Maybe a |
Convert an XML document encoded as a String, into a Haskell value. |
|
showXml :: (Haskell2Xml a) => a -> String |
Convert a Haskell value to an XML document, encoded as a String. |
|
IO conversion functions |
|
fReadXml :: (Haskell2Xml a) => FilePath -> IO a |
Read a Haskell value from an XML document stored in a file. |
|
fWriteXml :: (Haskell2Xml a) => FilePath -> a -> IO () |
Write a Haskell value to the given file as an XML document. |
|
hGetXml :: (Haskell2Xml a) => Handle -> IO a |
Read a Haskell value from an XML document transmitted through the
- given Handle. |
|
hPutXml :: (Haskell2Xml a) => Handle -> a -> IO () |
Write a Haskell value to the given Handle as an XML document. |
|
Auxiliary types |
|
data HType |
A concrete representation of any Haskell type. | Constructors | Maybe HType | | List HType | | Tuple [HType] | | Prim String String | separate Haskell name and Xml name | String | | Defined String [HType] [Constr] | A user-defined type has a name, a sequence of type variables,
- and a set of constructors. |
| Instances | |
|
|
data Constr |
A concrete representation of any user-defined Haskell constructor.
- The constructor has a name, and a sequence of component types. The
- first sequence of types represents the minimum set of free type
- variables occurring in the (second) list of real component types. | Constructors | |
|
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.Haskell2Xml.html
hunk ./docs/HaXml/Text.XML.HaXml.Html.Generate.html 1
-
-
- |
|
|
|
Contents |
- Entry points to the lexer
- Token and position types
|
|
Description |
You don't normally need to use this Lex module directly - it is
- called automatically by the parser. (This interface is only exposed
- for debugging purposes.) This is a hand-written lexer for tokenising the text of an XML
- document so that it is ready for parsing. It attaches position
- information in (line,column) format to every token. The main
- entry point is xmlLex. A secondary entry point, xmlReLex, is
- provided for when the parser needs to stuff a string back onto
- the front of the text and re-tokenise it (typically when expanding
- macros). As one would expect, the lexer is essentially a small finite
- state machine. |
|
Synopsis |
|
|
|
|
Entry points to the lexer |
|
xmlLex :: String -> String -> [Token] |
The first argument to xmlLex is the filename (used for source positions,
- especially in error messages), and the second is the string content of
- the XML file. |
|
xmlReLex :: Posn -> String -> [Token] |
xmlReLex is used when the parser expands a macro (PE reference).
- The expansion of the macro must be re-lexed as if for the first time. |
|
posInNewCxt :: String -> Maybe Posn -> Posn |
posInNewCxt name pos creates a new source position from an old one.
- It is used when opening a new file (e.g. a DTD inclusion), to denote
- the start of the file name, but retain the stacked information that
- it was included from the old pos. |
|
Token and position types |
|
type Token = Either String (Posn, TokenT) |
All tokens are paired up with a source position.
- Lexical errors are passed back through the Either type. |
|
data Posn |
Source positions contain a filename, line, column, and an
- inclusion point, which is itself another source position,
- recursively. | Constructors | Pn String !Int !Int (Maybe Posn) | |
| Instances | |
|
|
data TokenT |
The basic token type. | Constructors | TokCommentOpen | <!-- | TokCommentClose | --> | TokPIOpen | <? | TokPIClose | ?> | TokSectionOpen | <![ | TokSectionClose | ]]> | TokSection Section | CDATA INCLUDE IGNORE etc | TokSpecialOpen | <! | TokSpecial Special | DOCTYPE ELEMENT ATTLIST etc | TokEndOpen | </ | TokEndClose | /> | TokAnyOpen | < | TokAnyClose | > | TokSqOpen | [ | TokSqClose | ] | TokEqual | = | TokQuery | ? | TokStar | * | TokPlus | + | TokAmp | & | TokSemi | ; | TokHash | # | TokBraOpen | ( | TokBraClose | ) | TokPipe | | | TokPercent | % | TokComma | , | TokQuote | '' or "" | TokName String | begins with letter, no spaces | TokFreeText String | any character data | TokNull | fake token |
| Instances | |
|
|
data Special |
Constructors | DOCTYPEx | | ELEMENTx | | ATTLISTx | | ENTITYx | | NOTATIONx | |
|
|
|
data Section |
|
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.Lex.html
hunk ./docs/HaXml/Text.XML.HaXml.OneOfN.html 1
-
-
- |
|
|
|
|
|
|
|
data OneOf2 a b |
|
|
data OneOf3 a b c |
Constructors | OneOf3 a | | TwoOf3 b | | ThreeOf3 c | |
| Instances | |
|
|
data OneOf4 a b c d |
Constructors | OneOf4 a | | TwoOf4 b | | ThreeOf4 c | | FourOf4 d | |
| Instances | |
|
|
data OneOf5 a b c d e |
Constructors | OneOf5 a | | TwoOf5 b | | ThreeOf5 c | | FourOf5 d | | FiveOf5 e | |
| Instances | |
|
|
data OneOf6 a b c d e f |
Constructors | OneOf6 a | | TwoOf6 b | | ThreeOf6 c | | FourOf6 d | | FiveOf6 e | | SixOf6 f | |
| Instances | |
|
|
data OneOf7 a b c d e f g |
Constructors | OneOf7 a | | TwoOf7 b | | ThreeOf7 c | | FourOf7 d | | FiveOf7 e | | SixOf7 f | | SevenOf7 g | |
| Instances | |
|
|
data OneOf8 a b c d e f g h |
Constructors | OneOf8 a | | TwoOf8 b | | ThreeOf8 c | | FourOf8 d | | FiveOf8 e | | SixOf8 f | | SevenOf8 g | | EightOf8 h | |
| Instances | |
|
|
data OneOf9 a b c d e f g h i |
Constructors | OneOf9 a | | TwoOf9 b | | ThreeOf9 c | | FourOf9 d | | FiveOf9 e | | SixOf9 f | | SevenOf9 g | | EightOf9 h | | NineOf9 i | |
| Instances | |
|
|
data OneOf10 a b c d e f g h i j |
Constructors | OneOf10 a | | TwoOf10 b | | ThreeOf10 c | | FourOf10 d | | FiveOf10 e | | SixOf10 f | | SevenOf10 g | | EightOf10 h | | NineOf10 i | | TenOf10 j | |
| Instances | |
|
|
data OneOf11 a b c d e f g h i j k |
Constructors | OneOf11 a | | TwoOf11 b | | ThreeOf11 c | | FourOf11 d | | FiveOf11 e | | SixOf11 f | | SevenOf11 g | | EightOf11 h | | NineOf11 i | | TenOf11 j | | ElevenOf11 k | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k) => XmlContent (OneOf11 a b c d e f g h i j k) |
|
|
|
data OneOf12 a b c d e f g h i j k l |
Constructors | OneOf12 a | | TwoOf12 b | | ThreeOf12 c | | FourOf12 d | | FiveOf12 e | | SixOf12 f | | SevenOf12 g | | EightOf12 h | | NineOf12 i | | TenOf12 j | | ElevenOf12 k | | TwelveOf12 l | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l) => XmlContent (OneOf12 a b c d e f g h i j k l) |
|
|
|
data OneOf13 a b c d e f g h i j k l m |
Constructors | OneOf13 a | | TwoOf13 b | | ThreeOf13 c | | FourOf13 d | | FiveOf13 e | | SixOf13 f | | SevenOf13 g | | EightOf13 h | | NineOf13 i | | TenOf13 j | | ElevenOf13 k | | TwelveOf13 l | | ThirteenOf13 m | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m) => XmlContent (OneOf13 a b c d e f g h i j k l m) |
|
|
|
data OneOf14 a b c d e f g h i j k l m n |
Constructors | OneOf14 a | | TwoOf14 b | | ThreeOf14 c | | FourOf14 d | | FiveOf14 e | | SixOf14 f | | SevenOf14 g | | EightOf14 h | | NineOf14 i | | TenOf14 j | | ElevenOf14 k | | TwelveOf14 l | | ThirteenOf14 m | | FourteenOf14 n | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n) => XmlContent (OneOf14 a b c d e f g h i j k l m n) |
|
|
|
data OneOf15 a b c d e f g h i j k l m n o |
Constructors | OneOf15 a | | TwoOf15 b | | ThreeOf15 c | | FourOf15 d | | FiveOf15 e | | SixOf15 f | | SevenOf15 g | | EightOf15 h | | NineOf15 i | | TenOf15 j | | ElevenOf15 k | | TwelveOf15 l | | ThirteenOf15 m | | FourteenOf15 n | | FifteenOf15 o | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o) => XmlContent (OneOf15 a b c d e f g h i j k l m n o) |
|
|
|
data OneOf16 a b c d e f g h i j k l m n o p |
Constructors | OneOf16 a | | TwoOf16 b | | ThreeOf16 c | | FourOf16 d | | FiveOf16 e | | SixOf16 f | | SevenOf16 g | | EightOf16 h | | NineOf16 i | | TenOf16 j | | ElevenOf16 k | | TwelveOf16 l | | ThirteenOf16 m | | FourteenOf16 n | | FifteenOf16 o | | SixteenOf16 p | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p) => XmlContent (OneOf16 a b c d e f g h i j k l m n o p) |
|
|
|
data OneOf17 a b c d e f g h i j k l m n o p q |
Constructors | OneOf17 a | | TwoOf17 b | | ThreeOf17 c | | FourOf17 d | | FiveOf17 e | | SixOf17 f | | SevenOf17 g | | EightOf17 h | | NineOf17 i | | TenOf17 j | | ElevenOf17 k | | TwelveOf17 l | | ThirteenOf17 m | | FourteenOf17 n | | FifteenOf17 o | | SixteenOf17 p | | SeventeenOf17 q | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q) => XmlContent (OneOf17 a b c d e f g h i j k l m n o p q) |
|
|
|
data OneOf18 a b c d e f g h i j k l m n o p q r |
Constructors | OneOf18 a | | TwoOf18 b | | ThreeOf18 c | | FourOf18 d | | FiveOf18 e | | SixOf18 f | | SevenOf18 g | | EightOf18 h | | NineOf18 i | | TenOf18 j | | ElevenOf18 k | | TwelveOf18 l | | ThirteenOf18 m | | FourteenOf18 n | | FifteenOf18 o | | SixteenOf18 p | | SeventeenOf18 q | | EighteenOf18 r | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r) => XmlContent (OneOf18 a b c d e f g h i j k l m n o p q r) |
|
|
|
data OneOf19 a b c d e f g h i j k l m n o p q r s |
Constructors | OneOf19 a | | TwoOf19 b | | ThreeOf19 c | | FourOf19 d | | FiveOf19 e | | SixOf19 f | | SevenOf19 g | | EightOf19 h | | NineOf19 i | | TenOf19 j | | ElevenOf19 k | | TwelveOf19 l | | ThirteenOf19 m | | FourteenOf19 n | | FifteenOf19 o | | SixteenOf19 p | | SeventeenOf19 q | | EighteenOf19 r | | NineteenOf19 s | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s) => XmlContent (OneOf19 a b c d e f g h i j k l m n o p q r s) |
|
|
|
data OneOf20 a b c d e f g h i j k l m n o p q r s t |
Constructors | OneOf20 a | | TwoOf20 b | | ThreeOf20 c | | FourOf20 d | | FiveOf20 e | | SixOf20 f | | SevenOf20 g | | EightOf20 h | | NineOf20 i | | TenOf20 j | | ElevenOf20 k | | TwelveOf20 l | | ThirteenOf20 m | | FourteenOf20 n | | FifteenOf20 o | | SixteenOf20 p | | SeventeenOf20 q | | EighteenOf20 r | | NineteenOf20 s | | TwentyOf20 t | |
| Instances | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s, XmlContent t) => XmlContent (OneOf20 a b c d e f g h i j k l m n o p q r s t) |
|
|
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.OneOfN.html
hunk ./docs/HaXml/Text.XML.HaXml.Parse.html 1
-
-
-
rmfile ./docs/HaXml/Text.XML.HaXml.Types.html
hunk ./docs/HaXml/Text.XML.HaXml.Validate.html 1
-
-
- |
Text.XML.HaXml.Xml2Haskell |
|
|
|
Contents |
- Reading and writing XML data into a typed Haskell representation.
- The enabling classes.
- Parsing and printing helper functions
- Re-exports
|
|
Description |
This module provides the XmlContent class and readXml and writeXml
- functions that you will need if you generate a module of Haskell
- datatype definitions from an XML DTD. Use the DtdToHaskell
- program to generate both datatypes and instances of this class,
- then import this module to read and write values to and from XML files. |
|
Synopsis |
|
|
|
|
Reading and writing XML data into a typed Haskell representation. |
|
readXml :: (XmlContent a) => String -> Maybe a |
Read a fully-typed XML document from a string. |
|
showXml :: (XmlContent a) => a -> String |
Convert a fully-typed XML document to a string. |
|
hGetXml :: (XmlContent a) => Handle -> IO a |
Read a fully-typed XML document from a file handle. |
|
hPutXml :: (XmlContent a) => Handle -> a -> IO () |
Write a fully-typed XML document to a file handle. |
|
fReadXml :: (XmlContent a) => FilePath -> IO a |
Read an XML document from a file and convert it to a fully-typed
- Haskell value. |
|
fWriteXml :: (XmlContent a) => FilePath -> a -> IO () |
Write a fully-typed Haskell value to the given file as an XML
- document. |
|
The enabling classes. |
|
class XmlContent a where |
The XmlContent class promises that an XML content element can be
- converted to and from a Haskell value. | | Methods | | | Instances | (XmlContent a, XmlContent b) => XmlContent (OneOf2 a b) | (XmlContent a, XmlContent b, XmlContent c) => XmlContent (OneOf3 a b c) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d) => XmlContent (OneOf4 a b c d) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e) => XmlContent (OneOf5 a b c d e) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f) => XmlContent (OneOf6 a b c d e f) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g) => XmlContent (OneOf7 a b c d e f g) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h) => XmlContent (OneOf8 a b c d e f g h) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i) => XmlContent (OneOf9 a b c d e f g h i) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j) => XmlContent (OneOf10 a b c d e f g h i j) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k) => XmlContent (OneOf11 a b c d e f g h i j k) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l) => XmlContent (OneOf12 a b c d e f g h i j k l) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m) => XmlContent (OneOf13 a b c d e f g h i j k l m) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n) => XmlContent (OneOf14 a b c d e f g h i j k l m n) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o) => XmlContent (OneOf15 a b c d e f g h i j k l m n o) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p) => XmlContent (OneOf16 a b c d e f g h i j k l m n o p) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q) => XmlContent (OneOf17 a b c d e f g h i j k l m n o p q) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r) => XmlContent (OneOf18 a b c d e f g h i j k l m n o p q r) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s) => XmlContent (OneOf19 a b c d e f g h i j k l m n o p q r s) | (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s, XmlContent t) => XmlContent (OneOf20 a b c d e f g h i j k l m n o p q r s t) | (XmlContent a, XmlContent b) => XmlContent (a, b) | (XmlContent a, XmlContent b, XmlContent c) => XmlContent (a, b, c) | (XmlContent a) => XmlContent [a] | (XmlContent a) => XmlContent (Maybe a) | (XmlContent a) => XmlContent (List1 a) | XmlContent ANYContent |
|
|
|
class XmlAttributes a where |
The XmlAttributes class promises that a list of XML tag attributes
- can be converted to and from a Haskell value. | | Methods | |
|
|
class XmlAttrType a where |
The XmlAttrType class promises that an attribute taking an XML enumerated
- type can be converted to and from a Haskell value. | | Methods | toAttrFrTyp :: String -> a -> Maybe Attribute | | fromAttrToTyp :: String -> Attribute -> Maybe a |
|
|
|
Parsing and printing helper functions |
|
choice :: (XmlContent a) => (a -> b) -> ([Content] -> (Maybe b, [Content])) -> [Content] -> (Maybe b, [Content]) |
|
definite :: ([Content] -> (Maybe a, [Content])) -> String -> String -> [Content] -> (a, [Content]) |
|
many :: ([Content] -> (Maybe a, [Content])) -> [Content] -> ([a], [Content]) |
|
fromText :: [Content] -> (Maybe String, [Content]) |
|
toText :: String -> [Content] |
|
data List1 a |
The List1 type represents lists with at least one element.
- It is required for DTD content models that use + as a modifier. | Constructors | | Instances | |
|
|
data ANYContent |
A type corresponding to XML's ANY contentspec
-data ANYContent = forall a . XmlContent a => ANYContent a | Constructors | | Instances | |
|
|
maybeToAttr :: (String -> a -> Maybe Attribute) -> String -> Maybe a -> Maybe Attribute |
|
defaultToAttr :: (String -> a -> Maybe Attribute) -> String -> Defaultable a -> Maybe Attribute |
|
definiteA :: (String -> Attribute -> Maybe a) -> String -> String -> [Attribute] -> a |
|
defaultA :: (String -> Attribute -> Maybe a) -> a -> String -> [Attribute] -> Defaultable a |
|
possibleA :: (String -> Attribute -> Maybe a) -> String -> [Attribute] -> Maybe a |
|
fromAttrToStr :: String -> Attribute -> Maybe String |
|
toAttrFrStr :: String -> String -> Maybe Attribute |
|
data Defaultable a |
If an attribute is defaultable, then it either takes the default
- value (which is omitted from the output), or a non-default value
- (which obviously must be printed). | Constructors | |
|
|
str2attr :: String -> AttValue |
|
attr2str :: AttValue -> String |
|
Re-exports |
|
data Element |
|
|
data Content |
|
|
Produced by Haddock version 0.4 |
rmfile ./docs/HaXml/Text.XML.HaXml.Xml2Haskell.html
hunk ./docs/HaXml/Text.XML.HaXml.Xtract.Combinators.html 1
-
-
-
rmfile ./docs/HaXml/Text.XML.HaXml.Xtract.Combinators.html
hunk ./docs/HaXml/Text.XML.HaXml.Xtract.Lex.html 1
-
-
-