Provides type-based combinators to construct XML converters.
Arbitrary XML data can be represented as algebraic datatypes and vice versa.
See
here for a description of this library.
Author: Sebastian Fischer
Version: March 2006
| Exported names: |
Datatypes:
XAttrConv
| XElemConv
| XmlReads
| XmlShows
| XOptConv
| XPrimConv
| XRepConv
Functions:
!
| aBool
| aChar
| adapt
| aFloat
| aInt
| aString
| attr
| char
| eBool
| eChar
| eEmpty
| eFloat
| eInt
| element
| empty
| eOpt
| eRep
| eRepSeq1
| eRepSeq2
| eRepSeq3
| eRepSeq4
| eRepSeq5
| eRepSeq6
| eSeq1
| eSeq2
| eSeq3
| eSeq4
| eSeq5
| eSeq6
| eString
| float
| int
| opt
| rep
| repSeq1
| repSeq2
| repSeq3
| repSeq4
| repSeq5
| repSeq6
| seq1
| seq2
| seq3
| seq4
| seq5
| seq6
| string
| xmlRead
| xmlReads
| xmlShow
| xmlShows
| Summary of exported functions: |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
Type of functions that consume some XML data to compute a result
Type synonym: XmlReads a = ([(String,String)],[XmlExp]) -> (a,([(String,String)],[XmlExp]))
Type of functions that extend XML data corresponding to a given value
Type synonym: XmlShows a = a -> ([(String,String)],[XmlExp]) -> ([(String,String)],[XmlExp])
Type of converters for XML elements
Type synonym: XElemConv a = XmlConv Repeatable Elem a
Type of converters for attributes
Type synonym: XAttrConv a = XmlConv NotRepeatable NoElem a
Type of converters for primitive values
Type synonym: XPrimConv a = XmlConv NotRepeatable NoElem a
Type of converters for optional values
Type synonym: XOptConv a = XmlConv NotRepeatable NoElem a
Type of converters for repetitions
Type synonym: XRepConv a = XmlConv NotRepeatable NoElem a
| Exported functions: |
:: XmlConv a b c -> ([(String,String)],[XmlExp]) -> (c,([(String,String)],[XmlExp]))
Takes an XML converter and returns a function that consumes XML data
and returns the remaining data along with the result.
Example call: (xmlReads conv)
conv
XML converter
:: XmlConv a b c -> c -> ([(String,String)],[XmlExp]) -> ([(String,String)],[XmlExp])
Takes an XML converter and returns a function that extends XML data
with the representation of a given value.
Example call: (xmlShows conv)
conv
XML converter
:: XmlConv a Elem b -> XmlExp -> b
Takes an XML converter and an XML expression and returns a
corresponding Curry value.
Example call: (xmlRead conv)
conv
XML converter
:: XmlConv a Elem b -> b -> XmlExp
Takes an XML converter and a value and returns a corresponding
XML expression.
Example call: (xmlShow conv)
conv
XML converter
:: XmlConv NotRepeatable NoElem Int
Creates an XML converter for integer values. Integer values must not be
used in repetitions and do not represent XML elements.
:: XmlConv NotRepeatable NoElem Float
Creates an XML converter for float values. Float values must not be
used in repetitions and do not represent XML elements.
:: XmlConv NotRepeatable NoElem Char
Creates an XML converter for character values. Character values must not be
used in repetitions and do not represent XML elements.
:: XmlConv NotRepeatable NoElem String
Creates an XML converter for string values. String values must not be
used in repetitions and do not represent XML elements.
:: XmlConv a b c -> XmlConv a b c -> XmlConv a b c
Parallel composition of XML converters.
:: String -> XmlConv a b c -> XmlConv Repeatable Elem c
Takes an arbitrary XML converter and returns a converter representing
an XML element that contains the corresponding data. XML elements may be
used in repetitions.
Example call: (element name conv)
name
Tag name of the XML element
conv
XML converter for the childs of the XML element
:: a -> XmlConv NotRepeatable NoElem a
Takes a value and returns an XML converter for this value which is not
represented as XML data. Empty XML data must not be used in repetitions
and does not represent an XML element.
Example call: (empty val)
val
Value without an XML representation
:: String -> (String -> a,a -> String) -> XmlConv NotRepeatable NoElem a
Takes a name and string conversion functions and returns an XML converter
that represents an attribute. Attributes must not be used in repetitions
and do not represent an XML element.
Example call: (attr name readShow)
name
Attribute name
readShow
functions that convert between values and strings
:: (a -> b,b -> a) -> XmlConv c d a -> XmlConv c d b
Converts between arbitrary XML converters for different types.
Example call: (adapt a2b_b2a conv)
a2b_b2a
functions that convert between values of types a and b
conv
XML converter for type a
:: XmlConv a b c -> XmlConv NotRepeatable NoElem (Maybe c)
Creates a converter for arbitrary optional XML data. Optional XML data
must not be used in repetitions and does not represent an XML element.
Example call: (opt conv)
conv
XML converter
:: XmlConv Repeatable a b -> XmlConv NotRepeatable NoElem [b]
Takes an XML converter representing repeatable data and returns an
XML converter that represents repetitions of this data. Repetitions
must not be used in other repetitions and do not represent XML elements.
Example call: (rep conv)
conv
XML converter representing repeatable data
:: String -> XmlConv NotRepeatable NoElem Int
Creates an XML converter for integer attributes. Integer attributes
must not be used in repetitions and do not represent XML elements.
Example call: (aInt name)
name
Attribute name
:: String -> XmlConv NotRepeatable NoElem Float
Creates an XML converter for float attributes. Float attributes
must not be used in repetitions and do not represent XML elements.
Example call: (aFloat name)
name
Attribute name
:: String -> XmlConv NotRepeatable NoElem Char
Creates an XML converter for character attributes. Character attributes
must not be used in repetitions and do not represent XML elements.
Example call: (aChar name)
name
Attribute name
:: String -> XmlConv NotRepeatable NoElem String
Creates an XML converter for string attributes. String attributes
must not be used in repetitions and do not represent XML elements.
Example call: (aString name)
name
Attribute name
:: String -> String -> String -> XmlConv NotRepeatable NoElem Bool
Creates an XML converter for boolean attributes. Boolean attributes
must not be used in repetitions and do not represent XML elements.
Example call: (aBool name true false)
name
Attribute name
true
String representing True
false
String representing False
:: String -> XmlConv Repeatable Elem Int
Creates an XML converter for integer elements. Integer elements may be
used in repetitions.
Example call: (eInt name)
name
Tag name of the XML element containing the integer value
:: String -> XmlConv Repeatable Elem Float
Creates an XML converter for float elements. Float elements may be
used in repetitions.
Example call: (eFloat name)
name
Tag name of the XML element containing the float value
:: String -> XmlConv Repeatable Elem Char
Creates an XML converter for character elements. Character elements may be
used in repetitions.
Example call: (eChar name)
name
Tag name of the XML element containing the character value
:: String -> XmlConv Repeatable Elem String
Creates an XML converter for string elements. String elements may be
used in repetitions.
Example call: (eString name)
name
Tag name of the XML element containing the string value
:: String -> String -> XmlConv Repeatable Elem Bool
Creates an XML converter for boolean elements. Boolean elements may be
used in repetitions.
Example call: (eBool true false)
true
Tag name of the XML element representing True
false
Tag name of the XML element representing False
:: String -> a -> XmlConv Repeatable Elem a
Takes a name and a value and creates an empty XML element that represents
the given value. The created element may be used in repetitions.
Example call: (eEmpty name val)
name
Tag name of the empty element
val
Value represented by the empty element
:: String -> XmlConv a b c -> XmlConv Repeatable Elem (Maybe c)
Creates an XML converter that represents an element containing
optional XML data. The created element may be used in repetitions.
Example call: (eOpt name)
name
Tag name of the element containing optional XML data
:: String -> XmlConv Repeatable a b -> XmlConv Repeatable Elem [b]
Creates an XML converter that represents an element containing
repeated XML data. The created element may be used in repetitions.
Example call: (eRep name)
name
Tag name of the element containing repeated XML data
:: (a -> b) -> XmlConv c d a -> XmlConv c NoElem b
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq1 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b) -> XmlConv Repeatable c a -> XmlConv NotRepeatable NoElem [b]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions but does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq1 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b) -> XmlConv c d a -> XmlConv Repeatable Elem b
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq1 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b) -> XmlConv Repeatable c a -> XmlConv Repeatable Elem [b]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq1 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components
:: (a -> b -> c) -> XmlConv d e a -> XmlConv f g b -> XmlConv NotRepeatable NoElem c
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq2 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b -> c) -> XmlConv Repeatable d a -> XmlConv Repeatable e b -> XmlConv NotRepeatable NoElem [c]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions and does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq2 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b -> c) -> XmlConv d e a -> XmlConv f g b -> XmlConv Repeatable Elem c
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq2 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b -> c) -> XmlConv Repeatable d a -> XmlConv Repeatable e b -> XmlConv Repeatable Elem [c]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq2 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components
:: (a -> b -> c -> d) -> XmlConv e f a -> XmlConv g h b -> XmlConv i j c -> XmlConv NotRepeatable NoElem d
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq3 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b -> c -> d) -> XmlConv Repeatable e a -> XmlConv Repeatable f b -> XmlConv Repeatable g c -> XmlConv NotRepeatable NoElem [d]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions and does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq3 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b -> c -> d) -> XmlConv e f a -> XmlConv g h b -> XmlConv i j c -> XmlConv Repeatable Elem d
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq3 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b -> c -> d) -> XmlConv Repeatable e a -> XmlConv Repeatable f b -> XmlConv Repeatable g c -> XmlConv Repeatable Elem [d]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq3 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components
:: (a -> b -> c -> d -> e) -> XmlConv f g a -> XmlConv h i b -> XmlConv j k c -> XmlConv l m d -> XmlConv NotRepeatable NoElem e
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq4 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b -> c -> d -> e) -> XmlConv Repeatable f a -> XmlConv Repeatable g b -> XmlConv Repeatable h c -> XmlConv Repeatable i d -> XmlConv NotRepeatable NoElem [e]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions and does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq4 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b -> c -> d -> e) -> XmlConv f g a -> XmlConv h i b -> XmlConv j k c -> XmlConv l m d -> XmlConv Repeatable Elem e
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq4 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b -> c -> d -> e) -> XmlConv Repeatable f a -> XmlConv Repeatable g b -> XmlConv Repeatable h c -> XmlConv Repeatable i d -> XmlConv Repeatable Elem [e]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq4 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components
:: (a -> b -> c -> d -> e -> f) -> XmlConv g h a -> XmlConv i j b -> XmlConv k l c -> XmlConv m n d -> XmlConv o p e -> XmlConv NotRepeatable NoElem f
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq5 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b -> c -> d -> e -> f) -> XmlConv Repeatable g a -> XmlConv Repeatable h b -> XmlConv Repeatable i c -> XmlConv Repeatable j d -> XmlConv Repeatable k e -> XmlConv NotRepeatable NoElem [f]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions and does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq5 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b -> c -> d -> e -> f) -> XmlConv g h a -> XmlConv i j b -> XmlConv k l c -> XmlConv m n d -> XmlConv o p e -> XmlConv Repeatable Elem f
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq5 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b -> c -> d -> e -> f) -> XmlConv Repeatable g a -> XmlConv Repeatable h b -> XmlConv Repeatable i c -> XmlConv Repeatable j d -> XmlConv Repeatable k e -> XmlConv Repeatable Elem [f]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq5 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components
:: (a -> b -> c -> d -> e -> f -> g) -> XmlConv h i a -> XmlConv j k b -> XmlConv l m c -> XmlConv n o d -> XmlConv p q e -> XmlConv r s f -> XmlConv NotRepeatable NoElem g
Creates an XML converter representing a sequence of arbitrary XML data.
The sequence must not be used in repetitions and does not represent an
XML element.
Example call: (seq6 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: (a -> b -> c -> d -> e -> f -> g) -> XmlConv Repeatable h a -> XmlConv Repeatable i b -> XmlConv Repeatable j c -> XmlConv Repeatable k d -> XmlConv Repeatable l e -> XmlConv Repeatable m f -> XmlConv NotRepeatable NoElem [g]
Creates an XML converter that represents a repetition of a sequence
of repeatable XML data. The repetition may be used in other
repetitions and does not represent an XML element. This combinator is
provided because converters for repeatable sequences cannot be
constructed by the seq combinators.
Example call: (repSeq6 f conv)
f
Invertable function (constructor) that combines the sequence
conv(s) XML converter for the data contained in the sequence
:: String -> (a -> b -> c -> d -> e -> f -> g) -> XmlConv h i a -> XmlConv j k b -> XmlConv l m c -> XmlConv n o d -> XmlConv p q e -> XmlConv r s f -> XmlConv Repeatable Elem g
Creates an XML converter for compound values represented as an
XML element with children that correspond to the values components.
The element can be used in repetitions.
Example call: (eSeq6 name cons conv)
name
Tag name of the element
cons
constructor of the compound value
conv(s) XML converter for the components
:: String -> (a -> b -> c -> d -> e -> f -> g) -> XmlConv Repeatable h a -> XmlConv Repeatable i b -> XmlConv Repeatable j c -> XmlConv Repeatable k d -> XmlConv Repeatable l e -> XmlConv Repeatable m f -> XmlConv Repeatable Elem [g]
Creates an XML converter for repetitions of sequences represented as an
XML element that can be used in repetitions.
Example call: (eRepSeq6 name cons conv)
name
Tag name of the element
cons
constructor of the sequence
conv(s) XML converter for the components