Provides type-based combinators to construct XML converters.
Arbitrary XML data can be represented as algebraic datatypes and vice versa.
See a href="http://www-ps.informatik.uni-kiel.de/~sebf/projects/xmlconv/"
here/a
for a description of this library.
Author: Sebastian Fischer (with changes by Michael Hanus)
Version: February 2015
xmlReads
:: 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. |
xmlShows
:: 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. |
xmlRead
:: XmlConv a Elem b -> XmlExp -> b
Takes an XML converter and an XML expression and returns a corresponding Curry value. |
xmlShow
:: XmlConv a Elem b -> b -> XmlExp
Takes an XML converter and a value and returns a corresponding XML expression. |
int
:: XmlConv NotRepeatable NoElem Int
Creates an XML converter for integer values. |
float
:: XmlConv NotRepeatable NoElem Float
Creates an XML converter for float values. |
char
:: XmlConv NotRepeatable NoElem Char
Creates an XML converter for character values. |
string
:: XmlConv NotRepeatable NoElem String
Creates an XML converter for string values. |
(!)
:: XmlConv a b c -> XmlConv a b c -> XmlConv a b c
Parallel composition of XML converters. |
element
:: 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. |
empty
:: Data a => a -> XmlConv NotRepeatable NoElem a
Takes a value and returns an XML converter for this value which is not represented as XML data. |
attr
:: 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. |
adapt
:: (a -> b,b -> a) -> XmlConv c d a -> XmlConv c d b
Converts between arbitrary XML converters for different types. |
opt
:: XmlConv a b c -> XmlConv NotRepeatable NoElem (Maybe c)
Creates a converter for arbitrary optional XML data. |
rep
:: 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. |
aInt
:: String -> XmlConv NotRepeatable NoElem Int
Creates an XML converter for integer attributes. |
aFloat
:: String -> XmlConv NotRepeatable NoElem Float
Creates an XML converter for float attributes. |
aChar
:: String -> XmlConv NotRepeatable NoElem Char
Creates an XML converter for character attributes. |
aString
:: String -> XmlConv NotRepeatable NoElem String
Creates an XML converter for string attributes. |
aBool
:: String -> String -> String -> XmlConv NotRepeatable NoElem Bool
Creates an XML converter for boolean attributes. |
eInt
:: String -> XmlConv Repeatable Elem Int
Creates an XML converter for integer elements. |
eFloat
:: String -> XmlConv Repeatable Elem Float
Creates an XML converter for float elements. |
eChar
:: String -> XmlConv Repeatable Elem Char
Creates an XML converter for character elements. |
eString
:: String -> XmlConv Repeatable Elem String
Creates an XML converter for string elements. |
eBool
:: String -> String -> XmlConv Repeatable Elem Bool
Creates an XML converter for boolean elements. |
eEmpty
:: Data a => String -> a -> XmlConv Repeatable Elem a
Takes a name and a value and creates an empty XML element that represents the given value. |
eOpt
:: String -> XmlConv a b c -> XmlConv Repeatable Elem (Maybe c)
Creates an XML converter that represents an element containing optional XML data. |
eRep
:: String -> XmlConv Repeatable a b -> XmlConv Repeatable Elem [b]
Creates an XML converter that represents an element containing repeated XML data. |
seq1
:: (Data a, Data b) => (a -> b) -> XmlConv c d a -> XmlConv c NoElem b
Creates an XML converter representing a sequence of arbitrary XML data. |
repSeq1
:: (Data a, Data b) => (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. |
eSeq1
:: (Data a, Data b) => 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. |
eRepSeq1
:: (Data a, Data b) => 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. |
seq2
:: (Data a, Data b, Data c) => (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. |
repSeq2
:: (Data a, Data b, Data c) => (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. |
eSeq2
:: (Data a, Data b, Data c) => 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. |
eRepSeq2
:: (Data a, Data b, Data c) => 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. |
seq3
:: (Data a, Data b, Data c, Data d) => (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. |
repSeq3
:: (Data a, Data b, Data c, Data d) => (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. |
eSeq3
:: (Data a, Data b, Data c, Data d) => 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. |
eRepSeq3
:: (Data a, Data b, Data c, Data d) => 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. |
seq4
:: (Data a, Data b, Data c, Data d, Data e) => (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. |
repSeq4
:: (Data a, Data b, Data c, Data d, Data e) => (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. |
eSeq4
:: (Data a, Data b, Data c, Data d, Data e) => 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. |
eRepSeq4
:: (Data a, Data b, Data c, Data d, Data e) => 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. |
seq5
:: (Data a, Data b, Data c, Data d, Data e, Data f) => (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. |
repSeq5
:: (Data a, Data b, Data c, Data d, Data e, Data f) => (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. |
eSeq5
:: (Data a, Data b, Data c, Data d, Data e, Data f) => 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. |
eRepSeq5
:: (Data a, Data b, Data c, Data d, Data e, Data f) => 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. |
seq6
:: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => (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. |
repSeq6
:: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => (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. |
eSeq6
:: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => 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. |
eRepSeq6
:: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => 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. |
Type of functions that consume some XML data to compute a result
Type synonym: XmlReads a = Childs -> (a,Childs)
Type of functions that extend XML data corresponding to a given value
Type synonym: XmlShows a = a -> Childs -> Childs
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
Takes an XML converter and returns a function that consumes XML data and returns the remaining data along with the result.
|
Takes an XML converter and returns a function that extends XML data with the representation of a given value.
|
Takes an XML converter and an XML expression and returns a corresponding Curry value.
|
Takes an XML converter and a value and returns a corresponding XML expression.
|
Creates an XML converter for integer values. Integer values must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for float values. Float values must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for character values. Character values must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for string values. String values must not be used in repetitions and do not represent XML elements.
|
Parallel composition of XML converters.
|
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.
|
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.
|
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.
|
Converts between arbitrary XML converters for different types.
|
Creates a converter for arbitrary optional XML data. Optional XML data must not be used in repetitions and does not represent an XML element.
|
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.
|
Creates an XML converter for integer attributes. Integer attributes must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for float attributes. Float attributes must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for character attributes. Character attributes must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for string attributes. String attributes must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for boolean attributes. Boolean attributes must not be used in repetitions and do not represent XML elements.
|
Creates an XML converter for integer elements. Integer elements may be used in repetitions.
|
Creates an XML converter for float elements. Float elements may be used in repetitions.
|
Creates an XML converter for character elements. Character elements may be used in repetitions.
|
Creates an XML converter for string elements. String elements may be used in repetitions.
|
Creates an XML converter for boolean elements. Boolean elements may be used in repetitions.
|
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.
|
Creates an XML converter that represents an element containing optional XML data. The created element may be used in repetitions.
|
Creates an XML converter that represents an element containing repeated XML data. The created element may be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|
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.
|
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.
|
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.
|
Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions.
|