hsp-0.10.0: Haskell Server Pages is a library for writing dynamic server-side web pages.

Portabilityrequires newtype deriving and MPTCs with fundeps and type families
Stabilityexperimental
MaintainerNiklas Broberg <niklas.broberg@gmail.com>
Safe HaskellNone

HSP.XMLGenerator

Description

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.

Synopsis

Documentation

newtype XMLGenT m a Source

The monad transformer that allows a monad to generate XML values.

Constructors

XMLGenT (m a) 

Instances

MonadTrans XMLGenT 
MonadRWS r w s m => MonadRWS r w s (XMLGenT m) 
MonadError e m => MonadError e (XMLGenT m) 
MonadReader r m => MonadReader r (XMLGenT m) 
MonadWriter w m => MonadWriter w (XMLGenT m) 
MonadState s m => MonadState s (XMLGenT m) 
(AppendChild m x, TypeCastM m1 m) => AppendChild m (XMLGenT m1 x) 
(TypeCastM m1 m, SetAttr m x) => SetAttr m (XMLGenT m1 x) 
(EmbedAsAttr m (Attr a v), TypeCastM m1 m) => EmbedAsAttr m (Attr a (XMLGenT m1 v)) 
(XMLGen m, EmbedAsAttr m a) => EmbedAsAttr m (XMLGenT m a) 
(EmbedAsChild m c, ~ (* -> *) m n) => EmbedAsChild m (XMLGenT n c) 
Monad m => Monad (XMLGenT m) 
Functor m => Functor (XMLGenT m) 
MonadPlus m => MonadPlus (XMLGenT m) 
Applicative m => Applicative (XMLGenT m) 
Alternative m => Alternative (XMLGenT m) 
MonadIO m => MonadIO (XMLGenT m) 
MonadCont m => MonadCont (XMLGenT m) 

unXMLGenT :: XMLGenT m a -> m aSource

un-lift.

mapXMLGenT :: (m a -> n b) -> XMLGenT m a -> XMLGenT n bSource

map the inner monad

type Name a = (Maybe a, a)Source

class Monad m => XMLGen m whereSource

Generate XML values in some XMLGenerator monad.

Associated Types

type XMLType m Source

type StringType m Source

data ChildType m Source

data AttributeType m Source

Instances

(Functor m, Monad m) => XMLGen (HSPT XML m) 

type GenXML m = XMLGenT m (XMLType m)Source

Type synonyms to avoid writing out the XMLnGenT all the time

class XMLGen m => EmbedAsChild m 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.

Methods

asChild :: c -> GenChildList mSource

Instances

XMLGen m => EmbedAsChild m () 
(XMLGen m, ~ * (XMLType m) x) => EmbedAsChild m x 
XMLGen m => EmbedAsChild m (ChildType m) 
EmbedAsChild m c => EmbedAsChild m [c] 
(EmbedAsChild m c, ~ (* -> *) m n) => EmbedAsChild m (XMLGenT n c) 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) () 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Char 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) String 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) XML 
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) [XML] 

data Attr n a Source

Constructors

n := a 

Instances

(EmbedAsAttr m (Attr a v), TypeCastM m1 m) => EmbedAsAttr m (Attr a (XMLGenT m1 v)) 
(Show n, Show a) => Show (Attr n a) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) 
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) 
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 

class XMLGen m => EmbedAsAttr m a whereSource

Similarly embed values as attributes of an XML element.

Instances

EmbedAsAttr m a => EmbedAsAttr m [a] 
XMLGen m => EmbedAsAttr m (AttributeType m) 
(EmbedAsAttr m (Attr a v), TypeCastM m1 m) => EmbedAsAttr m (Attr a (XMLGenT m1 v)) 
(XMLGen m, EmbedAsAttr m a) => EmbedAsAttr m (XMLGenT m a) 
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) 
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) 
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) 

class (XMLGen m, SetAttr m (XMLType m), AppendChild m (XMLType m), EmbedAsChild m (XMLType m), EmbedAsChild m [XMLType m], EmbedAsChild m Text, EmbedAsChild m Char, EmbedAsChild m (), EmbedAsAttr m (Attr Text Text), EmbedAsAttr m (Attr Text Int), EmbedAsAttr m (Attr Text Bool)) => XMLGenerator m Source

Instances

class XMLGen m => SetAttr m elem whereSource

Set attributes on XML elements

Methods

setAttr :: elem -> GenAttribute m -> GenXML mSource

setAll :: elem -> GenAttributeList m -> GenXML mSource

Instances

(TypeCastM m1 m, SetAttr m x) => SetAttr m (XMLGenT m1 x) 
(Functor m, Monad m) => SetAttr (HSPT XML m) XML 

(<@) :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> attr -> GenXML mSource

prepend attr to the list of attributes for the elem

set :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> attr -> GenXML mSource

prepend attr to the list of attributes for the elem

(<<@) :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> [attr] -> GenXML mSource

prepend the list of attr to the attributes for the elem

class XMLGen m => AppendChild m elem whereSource

Methods

appChild :: elem -> GenChild m -> GenXML mSource

appAll :: elem -> GenChildList m -> GenXML mSource

Instances

(AppendChild m x, TypeCastM m1 m) => AppendChild m (XMLGenT m1 x) 
(Functor m, Monad m) => AppendChild (HSPT XML m) XML 

(<:) :: (AppendChild m elem, EmbedAsChild m c) => elem -> c -> GenXML mSource

append child to the children of elem

app :: (AppendChild m elem, EmbedAsChild m c) => elem -> c -> GenXML mSource

append child to the children of elem

(<<:) :: (AppendChild m elem, EmbedAsChild m c) => elem -> [c] -> GenXML mSource

append children to the children of elem

class Show n => IsName n s 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.

Methods

toName :: n -> Name sSource

Instances

IsName String String

Strings can represent names, meaning a simple name with no domain.

IsName String Text

Strings can represent names, meaning a simple name with no domain.

IsName Text Text

strings can represent names, meaning a simple name with no domain.

IsName Text Text

Strings can represent names, meaning a simple name with no domain.

Show a => IsName (Name a) a

Names can represent names, of course.

IsName (String, String) Text

Pairs of strings can represent names, meaning a name qualified with a domain.

IsName (Text, Text) Text

Pairs of strings can represent names, meaning a name qualified with a domain.

IsName (Text, Text) Text

Pairs of strings can represent names, meaning a name qualified with a domain.

class TypeCast a b | a -> b, b -> a whereSource

Methods

typeCast :: a -> bSource

Instances

TypeCast' () a b => TypeCast a b 

class TypeCast' t a b | t a -> b, t b -> a whereSource

Methods

typeCast' :: t -> a -> bSource

Instances

TypeCast'' t a b => TypeCast' t a b 

class TypeCast'' t a b | t a -> b, t b -> a whereSource

Methods

typeCast'' :: t -> a -> bSource

Instances

TypeCast'' () a a 

class TypeCastM ma mb | ma -> mb, mb -> ma whereSource

Methods

typeCastM :: ma x -> mb xSource

Instances

TypeCastM' () ma mb => TypeCastM ma mb 

class TypeCastM' t ma mb | t ma -> mb, t mb -> ma whereSource

Methods

typeCastM' :: t -> ma x -> mb xSource

Instances

TypeCastM'' t ma mb => TypeCastM' t ma mb 

class TypeCastM'' t ma mb | t ma -> mb, t mb -> ma whereSource

Methods

typeCastM'' :: t -> ma x -> mb xSource

Instances

TypeCastM'' () ma ma