-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Haskell Server Pages is a library for writing dynamic server-side web pages.
--   
--   Haskell Server Pages (HSP) is an extension of vanilla Haskell,
--   targetted at the task of writing dynamic server-side web pages.
--   Features include:
--   
--   
--   
- Embedded XML syntax
--   
- A (low-to-mid-level) programming model for writing dynamic web
--   pages
--   
- A cgi-handler utility (as a separate package, hsp-cgi)
--   
--   
--   For details on usage, please see the website, and the author's thesis.
@package hsp
@version 0.10.0

-- | Escaping between CDATA = PCDATA
module HSP.XML.PCDATA

-- | Take a normal string and transform it to PCDATA by escaping special
--   characters. calls escaper with xmlEscapeChars See also:
--   escaper
escape :: Text -> Builder

-- | Take a normal string and transform it to PCDATA by escaping special
--   characters. See also: escape, xmlEscapeChars
escaper :: [(Char, Builder)] -> Text -> Builder
xmlEscapeChars :: [(Char, Builder)]

-- | Datatypes and type classes comprising the basic model behind the
--   scenes of Haskell Server Pages tags.
module HSP.XML

-- | The XML datatype representation. Is either an Element or CDATA.
data XML
Element :: NSName -> Attributes -> Children -> XML
CDATA :: Bool -> Text -> XML

-- | The XMLMetaData datatype
--   
--   Specify the DOCTYPE, content-type, and preferred render for XML data.
--   
--   See also: setMetaData and withMetaData
data XMLMetaData
XMLMetaData :: (Bool, Text) -> Text -> (XML -> Builder) -> XMLMetaData

-- | (show doctype when rendering, DOCTYPE string)
[doctype] :: XMLMetaData -> (Bool, Text)
[contentType] :: XMLMetaData -> Text
[preferredRenderer] :: XMLMetaData -> XML -> Builder
type Namespace = Maybe Text
type NSName = (Namespace, Text)
type Attributes = [Attribute]
type Children = [XML]

-- | Embeds a string as a CDATA XML value.
pcdata :: Text -> XML

-- | Embeds a string as a CDATA XML value.
cdata :: Text -> XML
newtype Attribute
MkAttr :: (NSName, AttrValue) -> Attribute

-- | Represents an attribue value.
data AttrValue
Value :: Bool -> Text -> AttrValue
NoValue :: AttrValue

-- | Create an attribue value from a string.
attrVal :: Text -> AttrValue

-- | Create an attribue value from a string.
pAttrVal :: Text -> AttrValue

-- | Pretty-prints XML values.
renderXML :: XML -> Text

-- | Test whether an XML value is an Element or CDATA
isElement :: XML -> Bool

-- | Test whether an XML value is an Element or CDATA
isCDATA :: XML -> Bool
fromStringLit :: String -> Text
instance GHC.Show.Show HSP.XML.XML
instance GHC.Show.Show HSP.XML.Attribute
instance GHC.Show.Show HSP.XML.AttrValue

-- | Attempt to render XHTML as well-formed HTML 4.01:
--   
--   
--   
- no short tags are used, e.g., <script></script>
--   instead of <script />
--   
- the end tag is forbidden for some elements, for these we:
--   
--   
--   
--   
- render only the open tag, e.g., <br>
--   
- throw an error if the tag contains children
--   
--   
--   
--   
- optional end tags are always rendered
--   
--   
--   Currently no validation is performed.
module HSP.HTML4

-- | Pretty-prints HTML values.
--   
--   Error Handling:
--   
--   Some tags (such as img) can not contain children in HTML. However,
--   there is nothing to stop the caller from passing in XML which contains
--   an img tag with children. There are three basic ways to handle this:
--   
--   
--   
- drop the bogus children silently
--   
- call error / raise an exception
--   
- render the img tag with children -- even though it is invalid
--   
--   
--   Currently we are taking approach #3, since no other attempts to
--   validate the data are made in this function. Instead, you can run the
--   output through a full HTML validator to detect the errors.
--   
--   #1 seems like a poor choice, since it makes is easy to overlook the
--   fact that data went missing.
--   
--   We could raising errors, but you have to be in the IO monad to catch
--   them. Also, you have to use evaluate if you want to check for errors.
--   This means you can not start sending the page until the whole page has
--   been rendered. And you have to store the whole page in RAM at once.
--   Similar problems occur if we return Either instead. We mostly care
--   about catching errors and showing them in the browser during testing,
--   so perhaps this can be configurable.
--   
--   Another solution would be a compile time error if an empty-only tag
--   contained children.
--   
--   FIXME: also verify that the domain is correct
--   
--   FIXME: what to do if a namespace is encountered
renderAsHTML :: XML -> Text
htmlEscapeChars :: [(Char, Builder)]
html4Strict :: Maybe XMLMetaData
html4StrictFrag :: Maybe XMLMetaData

-- | 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.
module HSP.XMLGenerator

-- | The monad transformer that allows a monad to generate XML values.
newtype XMLGenT m a
XMLGenT :: (m a) -> XMLGenT m a

-- | un-lift.
unXMLGenT :: XMLGenT m a -> m a

-- | map the inner monad
mapXMLGenT :: (m a -> n b) -> XMLGenT m a -> XMLGenT n b
type Name a = (Maybe a, a)

-- | Generate XML values in some XMLGenerator monad.
class Monad m => XMLGen m where type family XMLType m type family StringType m data family ChildType m data family AttributeType m genEElement n ats = genElement n ats []
genElement :: XMLGen m => Name (StringType m) -> [XMLGenT m [AttributeType m]] -> [XMLGenT m [ChildType m]] -> XMLGenT m (XMLType m)
genEElement :: XMLGen m => Name (StringType m) -> [XMLGenT m [AttributeType m]] -> XMLGenT m (XMLType m)
xmlToChild :: XMLGen m => XMLType m -> ChildType m
pcdataToChild :: XMLGen m => StringType m -> ChildType m

-- | Type synonyms to avoid writing out the XMLnGenT all the time
type GenXML m = XMLGenT m (XMLType m)
type GenXMLList m = XMLGenT m [XMLType m]
type GenChild m = XMLGenT m (ChildType m)
type GenChildList m = XMLGenT m [ChildType m]
type GenAttribute m = XMLGenT m (AttributeType m)
type GenAttributeList m = XMLGenT m [AttributeType m]

-- | Embed values as child nodes of an XML element. The parent type will be
--   clear from the context so it is not mentioned.
class XMLGen m => EmbedAsChild m c
asChild :: EmbedAsChild m c => c -> GenChildList m
data Attr n a
(:=) :: n -> a -> Attr n a

-- | Similarly embed values as attributes of an XML element.
class XMLGen m => EmbedAsAttr m a
asAttr :: EmbedAsAttr m a => a -> GenAttributeList m
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

-- | Set attributes on XML elements
class XMLGen m => SetAttr m elem where setAttr e a = setAll e $ liftM return a
setAttr :: SetAttr m elem => elem -> GenAttribute m -> GenXML m
setAll :: SetAttr m elem => elem -> GenAttributeList m -> GenXML m

-- | prepend attr to the list of attributes for the elem
(<@) :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> attr -> GenXML m

-- | prepend attr to the list of attributes for the elem
set :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> attr -> GenXML m

-- | prepend the list of attr to the attributes for the
--   elem
(<<@) :: (SetAttr m elem, EmbedAsAttr m attr) => elem -> [attr] -> GenXML m
class XMLGen m => AppendChild m elem where appChild e c = appAll e $ liftM return c
appChild :: AppendChild m elem => elem -> GenChild m -> GenXML m
appAll :: AppendChild m elem => elem -> GenChildList m -> GenXML m

-- | append child to the children of elem
(<:) :: (AppendChild m elem, EmbedAsChild m c) => elem -> c -> GenXML m

-- | append child to the children of elem
app :: (AppendChild m elem, EmbedAsChild m c) => elem -> c -> GenXML m

-- | append children to the children of elem
(<<:) :: (AppendChild m elem, EmbedAsChild m c) => elem -> [c] -> GenXML m

-- | 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 Show n => IsName n s
toName :: IsName n s => n -> Name s

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

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

-- | Names can represent names, of course.

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

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

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

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

-- | Pairs of strings can represent names, meaning a name qualified with a
--   domain.
class TypeCast a b | a -> b, b -> a
typeCast :: TypeCast a b => a -> b
class TypeCast' t a b | t a -> b, t b -> a
typeCast' :: TypeCast' t a b => t -> a -> b
class TypeCast'' t a b | t a -> b, t b -> a
typeCast'' :: TypeCast'' t a b => t -> a -> b
class TypeCastM ma mb | ma -> mb, mb -> ma
typeCastM :: TypeCastM ma mb => ma x -> mb x
class TypeCastM' t ma mb | t ma -> mb, t mb -> ma
typeCastM' :: TypeCastM' t ma mb => t -> ma x -> mb x
class TypeCastM'' t ma mb | t ma -> mb, t mb -> ma
typeCastM'' :: TypeCastM'' t ma mb => t -> ma x -> mb x
instance (GHC.Show.Show n, GHC.Show.Show a) => GHC.Show.Show (HSP.XMLGenerator.Attr n a)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.RWS.Class.MonadRWS r w s m => Control.Monad.RWS.Class.MonadRWS r w s (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (HSP.XMLGenerator.XMLGenT m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (HSP.XMLGenerator.XMLGenT m)
instance GHC.Base.Functor m => GHC.Base.Functor (HSP.XMLGenerator.XMLGenT m)
instance GHC.Base.Monad m => GHC.Base.Monad (HSP.XMLGenerator.XMLGenT m)
instance GHC.Base.Alternative m => GHC.Base.Alternative (HSP.XMLGenerator.XMLGenT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (HSP.XMLGenerator.XMLGenT m)
instance Control.Monad.Trans.Class.MonadTrans HSP.XMLGenerator.XMLGenT
instance (HSP.XMLGenerator.EmbedAsChild m c, m ~ n) => HSP.XMLGenerator.EmbedAsChild m (HSP.XMLGenerator.XMLGenT n c)
instance HSP.XMLGenerator.EmbedAsChild m c => HSP.XMLGenerator.EmbedAsChild m [c]
instance HSP.XMLGenerator.XMLGen m => HSP.XMLGenerator.EmbedAsChild m (HSP.XMLGenerator.ChildType m)
instance (HSP.XMLGenerator.XMLGen m, HSP.XMLGenerator.XMLType m ~ x) => HSP.XMLGenerator.EmbedAsChild m x
instance HSP.XMLGenerator.XMLGen m => HSP.XMLGenerator.EmbedAsChild m ()
instance (HSP.XMLGenerator.XMLGen m, HSP.XMLGenerator.EmbedAsAttr m a) => HSP.XMLGenerator.EmbedAsAttr m (HSP.XMLGenerator.XMLGenT m a)
instance (HSP.XMLGenerator.EmbedAsAttr m (HSP.XMLGenerator.Attr a v), HSP.XMLGenerator.TypeCastM m1 m) => HSP.XMLGenerator.EmbedAsAttr m (HSP.XMLGenerator.Attr a (HSP.XMLGenerator.XMLGenT m1 v))
instance HSP.XMLGenerator.XMLGen m => HSP.XMLGenerator.EmbedAsAttr m (HSP.XMLGenerator.AttributeType m)
instance HSP.XMLGenerator.EmbedAsAttr m a => HSP.XMLGenerator.EmbedAsAttr m [a]
instance (HSP.XMLGenerator.TypeCastM m1 m, HSP.XMLGenerator.SetAttr m x) => HSP.XMLGenerator.SetAttr m (HSP.XMLGenerator.XMLGenT m1 x)
instance (HSP.XMLGenerator.AppendChild m x, HSP.XMLGenerator.TypeCastM m1 m) => HSP.XMLGenerator.AppendChild m (HSP.XMLGenerator.XMLGenT m1 x)
instance HSP.XMLGenerator.IsName GHC.Base.String GHC.Base.String
instance HSP.XMLGenerator.IsName GHC.Base.String Data.Text.Internal.Lazy.Text
instance GHC.Show.Show a => HSP.XMLGenerator.IsName (HSP.XMLGenerator.Name a) a
instance HSP.XMLGenerator.IsName (GHC.Base.String, GHC.Base.String) Data.Text.Internal.Lazy.Text
instance HSP.XMLGenerator.IsName Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text
instance HSP.XMLGenerator.IsName Data.Text.Internal.Text Data.Text.Internal.Lazy.Text
instance HSP.XMLGenerator.IsName (Data.Text.Internal.Lazy.Text, Data.Text.Internal.Lazy.Text) Data.Text.Internal.Lazy.Text
instance HSP.XMLGenerator.IsName (Data.Text.Internal.Text, Data.Text.Internal.Text) Data.Text.Internal.Lazy.Text
instance HSP.XMLGenerator.TypeCast' () a b => HSP.XMLGenerator.TypeCast a b
instance HSP.XMLGenerator.TypeCast'' t a b => HSP.XMLGenerator.TypeCast' t a b
instance HSP.XMLGenerator.TypeCast'' () a a
instance HSP.XMLGenerator.TypeCastM' () ma mb => HSP.XMLGenerator.TypeCastM ma mb
instance HSP.XMLGenerator.TypeCastM'' t ma mb => HSP.XMLGenerator.TypeCastM' t ma mb
instance HSP.XMLGenerator.TypeCastM'' () ma ma

module HSP.Monad
newtype HSPT xml m a
HSPT :: m a -> HSPT xml m a
[unHSPT] :: HSPT xml m a -> m a
instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (HSP.Monad.HSPT xml m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (HSP.Monad.HSPT xml m)
instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (HSP.Monad.HSPT xml m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (HSP.Monad.HSPT xml m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (HSP.Monad.HSPT xml m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (HSP.Monad.HSPT xml m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (HSP.Monad.HSPT xml m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (HSP.Monad.HSPT xml m)
instance GHC.Base.Monad m => GHC.Base.Monad (HSP.Monad.HSPT xml m)
instance GHC.Base.Alternative m => GHC.Base.Alternative (HSP.Monad.HSPT xml m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (HSP.Monad.HSPT xml m)
instance GHC.Base.Functor m => GHC.Base.Functor (HSP.Monad.HSPT xml m)
instance Control.Monad.Trans.Class.MonadTrans (HSP.Monad.HSPT xml)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.XMLGen (HSP.Monad.HSPT HSP.XML.XML m)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.SetAttr (HSP.Monad.HSPT HSP.XML.XML m) HSP.XML.XML
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.AppendChild (HSP.Monad.HSPT HSP.XML.XML m) HSP.XML.XML
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) HSP.XML.XML
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) [HSP.XML.XML]
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) GHC.Base.String
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) Data.Text.Internal.Lazy.Text
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) Data.Text.Internal.Text
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) GHC.Types.Char
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsChild (HSP.Monad.HSPT HSP.XML.XML m) ()
instance (GHC.Base.Monad m, GHC.Base.Functor m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) HSP.XML.Attribute
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text Data.Text.Internal.Lazy.Text)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text Data.Text.Internal.Text)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text Data.Text.Internal.Text)
instance (GHC.Base.Monad m, GHC.Base.Functor m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text GHC.Types.Char)
instance (GHC.Base.Monad m, GHC.Base.Functor m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text GHC.Types.Char)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text GHC.Types.Bool)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text GHC.Types.Bool)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text GHC.Types.Int)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text GHC.Types.Int)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Lazy.Text ())
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.EmbedAsAttr (HSP.Monad.HSPT HSP.XML.XML m) (HSP.XMLGenerator.Attr Data.Text.Internal.Text ())
instance (GHC.Base.Functor m, GHC.Base.Monad m) => HSP.XMLGenerator.XMLGenerator (HSP.Monad.HSPT HSP.XML.XML m)

module HSP
