Portability | requires newtype deriving and MPTCs with fundeps |
---|---|
Stability | experimental |
Maintainer | Niklas Broberg, nibro@cs.chalmers.se |
The class and monad transformer that forms the basis of the literal XML syntax translation. Literal tags will be translated into functions of the GenerateXML class, and any instantiating monads with associated XML types can benefit from that syntax.
- newtype XMLGenT m a = XMLGenT (m a)
- unXMLGenT :: XMLGenT m a -> m a
- type Name = (Maybe String, String)
- class Monad m => XMLGenerator m where
- class EmbedAsChild a c where
- asChild :: a -> c
- class EmbedAsAttr a at where
- asAttr :: a -> at
- data Attr n a = n := a
- class XMLGenerator m => SetAttr m t where
- set :: (SetAttr m t, EmbedAsAttr a (XMLGenT m (Attribute m))) => t -> a -> XMLGenT m (XML m)
- (<@) :: (SetAttr m t, EmbedAsAttr a (XMLGenT m (Attribute m))) => t -> a -> XMLGenT m (XML m)
- (<<@) :: (SetAttr m t, EmbedAsAttr a (XMLGenT m (Attribute m))) => t -> [a] -> XMLGenT m (XML m)
- class XMLGenerator m => AppendChild m t where
- app :: (AppendChild m t, EmbedAsChild c (XMLGenT m [Child m])) => t -> c -> XMLGenT m (XML m)
- (<:) :: (AppendChild m t, EmbedAsChild c (XMLGenT m [Child m])) => t -> c -> XMLGenT m (XML m)
- class Show n => IsName n where
- class TypeCast a b | a -> b, b -> a where
- typeCast :: a -> b
- class TypeCast' t a b | t a -> b, t b -> a where
- typeCast' :: t -> a -> b
- class TypeCast'' t a b | t a -> b, t b -> a where
- typeCast'' :: t -> a -> b
Documentation
The monad transformer that allows a monad to generate XML values.
XMLGenT (m a) |
class Monad m => XMLGenerator m whereSource
Generate XML values in some XMLGenerator monad.
class EmbedAsChild a c whereSource
Embed values as child nodes of an XML element. The parent type will be clear from the context so it is not mentioned.
class EmbedAsAttr a at whereSource
Similarly embed values as attributes of an XML element.
class XMLGenerator m => SetAttr m t whereSource
Set attributes on XML elements
(<<@) :: (SetAttr m t, EmbedAsAttr a (XMLGenT m (Attribute m))) => t -> [a] -> XMLGenT m (XML m)Source
class XMLGenerator m => AppendChild m t whereSource
app :: (AppendChild m t, EmbedAsChild c (XMLGenT m [Child m])) => t -> c -> XMLGenT m (XML m)Source
(<:) :: (AppendChild m t, EmbedAsChild c (XMLGenT m [Child m])) => t -> c -> XMLGenT m (XML m)Source
class Show n => IsName n whereSource
Names can be simple or qualified with a domain. We want to conveniently use both simple strings or pairs wherever a Name is expected.
class TypeCast' t a b | t a -> b, t b -> a whereSource
TypeCast'' t a b => TypeCast' t a b |
class TypeCast'' t a b | t a -> b, t b -> a whereSource
typeCast'' :: t -> a -> bSource
TypeCast'' () a a |