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


-- | A blazingly fast markup combinator library for Haskell
--   
--   Core modules of a blazingly fast markup combinator library for the
--   Haskell programming language. The Text.Blaze module is a good starting
--   point, as well as this tutorial:
--   <a>http://jaspervdj.be/blaze/tutorial.html</a>.
@package blaze-markup
@version 0.7.0.3


-- | The BlazeMarkup core, consisting of functions that offer the power to
--   generate custom markup elements. It also offers user-centric
--   functions, which are exposed through <a>Blaze</a>.
--   
--   While this module is exported, usage of it is not recommended, unless
--   you know what you are doing. This module might undergo changes at any
--   time.
module Text.Blaze.Internal

-- | A string denoting input from different string representations.
data ChoiceString

-- | Static data
Static :: {-# UNPACK #-} !StaticString -> ChoiceString

-- | A Haskell String
String :: String -> ChoiceString

-- | A Text value
Text :: Text -> ChoiceString

-- | An encoded bytestring
ByteString :: ByteString -> ChoiceString

-- | A pre-escaped string
PreEscaped :: ChoiceString -> ChoiceString

-- | External data in style/script tags, should be checked for validity
External :: ChoiceString -> ChoiceString

-- | Concatenation
AppendChoiceString :: ChoiceString -> ChoiceString -> ChoiceString

-- | Empty string
EmptyChoiceString :: ChoiceString

-- | A static string that supports efficient output to all possible
--   backends.
data StaticString
StaticString :: (String -> String) -> ByteString -> Text -> StaticString

-- | Appending haskell string
[getString] :: StaticString -> String -> String

-- | UTF-8 encoded bytestring
[getUtf8ByteString] :: StaticString -> ByteString

-- | Text value
[getText] :: StaticString -> Text

-- | The core Markup datatype.
data MarkupM a

-- | Tag, open tag, end tag, content
Parent :: StaticString -> StaticString -> StaticString -> (MarkupM b) -> MarkupM a

-- | Custom parent
CustomParent :: ChoiceString -> (MarkupM b) -> MarkupM a

-- | Tag, open tag, end tag
Leaf :: StaticString -> StaticString -> StaticString -> MarkupM a

-- | Custom leaf
CustomLeaf :: ChoiceString -> Bool -> MarkupM a

-- | HTML content
Content :: ChoiceString -> MarkupM a

-- | HTML comment. Note: you should wrap the <a>ChoiceString</a> in a
--   <a>PreEscaped</a>.
Comment :: ChoiceString -> MarkupM a

-- | Concatenation of two HTML pieces
Append :: (MarkupM b) -> (MarkupM c) -> MarkupM a

-- | Add an attribute to the inner HTML. Raw key, key, value, HTML to
--   receive the attribute.
AddAttribute :: StaticString -> StaticString -> ChoiceString -> (MarkupM a) -> MarkupM a

-- | Add a custom attribute to the inner HTML.
AddCustomAttribute :: ChoiceString -> ChoiceString -> (MarkupM a) -> MarkupM a

-- | Empty HTML.
Empty :: MarkupM a

-- | Simplification of the <a>MarkupM</a> datatype.
type Markup = MarkupM ()

-- | Type for an HTML tag. This can be seen as an internal string type used
--   by BlazeMarkup.
data Tag

-- | Type for an attribute.
data Attribute

-- | The type for the value part of an attribute.
data AttributeValue

-- | Create a custom parent element
customParent :: Tag -> Markup -> Markup

-- | Create a custom leaf element
customLeaf :: Tag -> Bool -> Markup

-- | Create an HTML attribute that can be applied to an HTML element later
--   using the <a>!</a> operator.
attribute :: Tag -> Tag -> AttributeValue -> Attribute

-- | From HTML 5 onwards, the user is able to specify custom data
--   attributes.
--   
--   An example:
--   
--   <pre>
--   &lt;p data-foo="bar"&gt;Hello.&lt;/p&gt;
--   </pre>
--   
--   We support this in BlazeMarkup using this funcion. The above fragment
--   could be described using BlazeMarkup with:
--   
--   <pre>
--   p ! dataAttribute "foo" "bar" $ "Hello."
--   </pre>
dataAttribute :: Tag -> AttributeValue -> Attribute

-- | Create a custom attribute. This is not specified in the HTML spec, but
--   some JavaScript libraries rely on it.
--   
--   An example:
--   
--   <pre>
--   &lt;select dojoType="select"&gt;foo&lt;/select&gt;
--   </pre>
--   
--   Can be produced using:
--   
--   <pre>
--   select ! customAttribute "dojoType" "select" $ "foo"
--   </pre>
customAttribute :: Tag -> AttributeValue -> Attribute

-- | Render text. Functions like these can be used to supply content in
--   HTML.
text :: Text -> Markup

-- | Render text without escaping.
preEscapedText :: Text -> Markup

-- | A variant of <a>text</a> for lazy <a>Text</a>.
lazyText :: Text -> Markup

-- | A variant of <a>preEscapedText</a> for lazy <a>Text</a>
preEscapedLazyText :: Text -> Markup

-- | Create an HTML snippet from a <a>String</a>.
string :: String -> Markup

-- | Create an HTML snippet from a <a>String</a> without escaping
preEscapedString :: String -> Markup

-- | Insert a <a>ByteString</a>. This is an unsafe operation:
--   
--   <ul>
--   <li>The <a>ByteString</a> could have the wrong encoding.</li>
--   <li>The <a>ByteString</a> might contain illegal HTML characters (no
--   escaping is done).</li>
--   </ul>
unsafeByteString :: ByteString -> Markup

-- | Insert a lazy <a>ByteString</a>. See <a>unsafeByteString</a> for
--   reasons why this is an unsafe operation.
unsafeLazyByteString :: ByteString -> Markup

-- | Create a comment from a <a>Text</a> value. The text should not contain
--   <tt>"--"</tt>. This is not checked by the library.
textComment :: Text -> Markup

-- | Create a comment from a <a>Text</a> value. The text should not contain
--   <tt>"--"</tt>. This is not checked by the library.
lazyTextComment :: Text -> Markup

-- | Create a comment from a <a>String</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
stringComment :: String -> Markup

-- | Create a comment from a <a>ByteString</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
unsafeByteStringComment :: ByteString -> Markup

-- | Create a comment from a <a>ByteString</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
unsafeLazyByteStringComment :: ByteString -> Markup

-- | Create a <a>Tag</a> from some <a>Text</a>.
textTag :: Text -> Tag

-- | Create a <a>Tag</a> from a <a>String</a>.
stringTag :: String -> Tag

-- | Render an attribute value from <a>Text</a>.
textValue :: Text -> AttributeValue

-- | Render an attribute value from <a>Text</a> without escaping.
preEscapedTextValue :: Text -> AttributeValue

-- | A variant of <a>textValue</a> for lazy <a>Text</a>
lazyTextValue :: Text -> AttributeValue

-- | A variant of <a>preEscapedTextValue</a> for lazy <a>Text</a>
preEscapedLazyTextValue :: Text -> AttributeValue

-- | Create an attribute value from a <a>String</a>.
stringValue :: String -> AttributeValue

-- | Create an attribute value from a <a>String</a> without escaping.
preEscapedStringValue :: String -> AttributeValue

-- | Create an attribute value from a <a>ByteString</a>. See
--   <a>unsafeByteString</a> for reasons why this might not be a good idea.
unsafeByteStringValue :: ByteString -> AttributeValue

-- | Create an attribute value from a lazy <a>ByteString</a>. See
--   <a>unsafeByteString</a> for reasons why this might not be a good idea.
unsafeLazyByteStringValue :: ByteString -> AttributeValue

-- | Used for applying attributes. You should not define your own instances
--   of this class.
class Attributable h

-- | Apply an attribute to an element.
--   
--   Example:
--   
--   <pre>
--   img ! src "foo.png"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   &lt;img src="foo.png" /&gt;
--   </pre>
--   
--   This can be used on nested elements as well.
--   
--   Example:
--   
--   <pre>
--   p ! style "float: right" $ "Hello!"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   &lt;p style="float: right"&gt;Hello!&lt;/p&gt;
--   </pre>
(!) :: Attributable h => h -> Attribute -> h

-- | Shorthand for setting an attribute depending on a conditional.
--   
--   Example:
--   
--   <pre>
--   p !? (isBig, A.class "big") $ "Hello"
--   </pre>
--   
--   Gives the same result as:
--   
--   <pre>
--   (if isBig then p ! A.class "big" else p) "Hello"
--   </pre>
(!?) :: Attributable h => h -> (Bool, Attribute) -> h

-- | Take only the text content of an HTML tree.
--   
--   <pre>
--   contents $ do
--       p ! $ "Hello "
--       p ! $ "Word!"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   Hello World!
--   </pre>
contents :: MarkupM a -> MarkupM b

-- | Mark HTML as external data. External data can be:
--   
--   <ul>
--   <li>CSS data in a <tt><a>style</a></tt> tag;</li>
--   <li>Script data in a <tt><a>script</a></tt> tag.</li>
--   </ul>
--   
--   This function is applied automatically when using the <tt>style</tt>
--   or <tt>script</tt> combinators.
external :: MarkupM a -> MarkupM a

-- | Check if a <a>Markup</a> value is completely empty (renders to the
--   empty string).
null :: MarkupM a -> Bool
instance GHC.Base.Monoid Text.Blaze.Internal.AttributeValue
instance Data.String.IsString Text.Blaze.Internal.AttributeValue
instance Data.String.IsString Text.Blaze.Internal.Tag
instance Data.String.IsString Text.Blaze.Internal.StaticString
instance GHC.Base.Monoid Text.Blaze.Internal.ChoiceString
instance Data.String.IsString Text.Blaze.Internal.ChoiceString
instance GHC.Base.Monoid a => GHC.Base.Monoid (Text.Blaze.Internal.MarkupM a)
instance GHC.Base.Functor Text.Blaze.Internal.MarkupM
instance GHC.Base.Applicative Text.Blaze.Internal.MarkupM
instance GHC.Base.Monad Text.Blaze.Internal.MarkupM
instance Data.String.IsString (Text.Blaze.Internal.MarkupM a)
instance GHC.Base.Monoid Text.Blaze.Internal.Attribute
instance Text.Blaze.Internal.Attributable (Text.Blaze.Internal.MarkupM a)
instance Text.Blaze.Internal.Attributable (Text.Blaze.Internal.MarkupM a -> Text.Blaze.Internal.MarkupM b)


-- | A renderer that produces a native Haskell <a>String</a>, mostly meant
--   for debugging purposes.
module Text.Blaze.Renderer.String

-- | Render a <a>ChoiceString</a>.
fromChoiceString :: ChoiceString -> String -> String

-- | Render markup to a lazy <a>String</a>.
renderMarkup :: Markup -> String

-- | <i>Deprecated: Use renderHtml from Text.Blaze.Html.Renderer.String
--   instead</i>
renderHtml :: Markup -> String


-- | A renderer that produces pretty HTML, mostly meant for debugging
--   purposes.
module Text.Blaze.Renderer.Pretty

-- | Render markup to a lazy <a>String</a>. The result is prettified.
renderMarkup :: Markup -> String

-- | <i>Deprecated: Use renderHtml from Text.Blaze.Html.Renderer.Pretty
--   instead</i>
renderHtml :: Markup -> String


-- | A renderer that produces a lazy <a>Text</a> value, using the Text
--   Builder.
module Text.Blaze.Renderer.Text

-- | Render markup to a text builder
renderMarkupBuilder :: Markup -> Builder

-- | Render some <a>Markup</a> to a Text <a>Builder</a>.
renderMarkupBuilderWith :: (ByteString -> Text) -> Markup -> Builder

-- | Render markup to a lazy Text value. If there are any ByteString's in
--   the input markup, this function will consider them as UTF-8 encoded
--   values and decode them that way.
renderMarkup :: Markup -> Text

-- | Render markup to a lazy Text value. This function allows you to
--   specify what should happen with ByteString's in the input HTML. You
--   can decode them or drop them, this depends on the application...
renderMarkupWith :: (ByteString -> Text) -> Markup -> Text

-- | <i>Deprecated: Use renderHtmlBuilder from
--   Text.Blaze.Html.Renderer.Text instead</i>
renderHtmlBuilder :: Markup -> Builder

-- | <i>Deprecated: Use renderHtmlBuilderWith from
--   Text.Blaze.Html.Renderer.Text instead</i>
renderHtmlBuilderWith :: (ByteString -> Text) -> Markup -> Builder

-- | <i>Deprecated: Use renderHtml from Text.Blaze.Html.Renderer.Text
--   instead</i>
renderHtml :: Markup -> Text

-- | <i>Deprecated: Use renderHtmlWith from Text.Blaze.Html.Renderer.Text
--   instead</i>
renderHtmlWith :: (ByteString -> Text) -> Markup -> Text

module Text.Blaze.Renderer.Utf8

-- | Render some <a>Markup</a> to a <a>Builder</a>.
renderMarkupBuilder :: Markup -> Builder

-- | Render HTML to a lazy UTF-8 encoded 'L.ByteString.'
renderMarkup :: Markup -> ByteString

-- | Repeatedly render HTML to a buffer and process this buffer using the
--   given IO action.
renderMarkupToByteStringIO :: (ByteString -> IO ()) -> Markup -> IO ()

-- | Render some <a>Markup</a> to a <a>Builder</a>.

-- | <i>Deprecated: Use renderHtmlBuilder from
--   Text.Blaze.Html.Renderer.Utf8 instead</i>
renderHtmlBuilder :: Markup -> Builder

-- | Render HTML to a lazy UTF-8 encoded 'L.ByteString.'

-- | <i>Deprecated: Use renderHtml from Text.Blaze.Html.Renderer.Utf8
--   instead</i>
renderHtml :: Markup -> ByteString

-- | Repeatedly render HTML to a buffer and process this buffer using the
--   given IO action.

-- | <i>Deprecated: Use renderMarkupToByteStringIO from
--   Text.Blaze.Html.Renderer.Utf8 instead</i>
renderHtmlToByteStringIO :: (ByteString -> IO ()) -> Markup -> IO ()


-- | BlazeMarkup is a markup combinator library. It provides a way to embed
--   markup languages like HTML and SVG in Haskell in an efficient and
--   convenient way, with a light-weight syntax.
--   
--   To use the library, one needs to import a set of combinators. For
--   example, you can use HTML 4 Strict from BlazeHtml package.
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   import Prelude hiding (head, id, div)
--   import Text.Blaze.Html4.Strict hiding (map)
--   import Text.Blaze.Html4.Strict.Attributes hiding (title)
--   </pre>
--   
--   To render the page later on, you need a so called Renderer. The
--   recommended renderer is an UTF-8 renderer which produces a lazy
--   bytestring.
--   
--   <pre>
--   import Text.Blaze.Renderer.Utf8 (renderMarkup)
--   </pre>
--   
--   Now, you can describe pages using the imported combinators.
--   
--   <pre>
--   page1 :: Markup
--   page1 = html $ do
--       head $ do
--           title "Introduction page."
--           link ! rel "stylesheet" ! type_ "text/css" ! href "screen.css"
--       body $ do
--           div ! id "header" $ "Syntax"
--           p "This is an example of BlazeMarkup syntax."
--           ul $ mapM_ (li . toMarkup . show) [1, 2, 3]
--   </pre>
--   
--   The resulting HTML can now be extracted using:
--   
--   <pre>
--   renderMarkup page1
--   </pre>
module Text.Blaze

-- | Simplification of the <a>MarkupM</a> datatype.
type Markup = MarkupM ()

-- | Type for an HTML tag. This can be seen as an internal string type used
--   by BlazeMarkup.
data Tag

-- | Type for an attribute.
data Attribute

-- | The type for the value part of an attribute.
data AttributeValue

-- | From HTML 5 onwards, the user is able to specify custom data
--   attributes.
--   
--   An example:
--   
--   <pre>
--   &lt;p data-foo="bar"&gt;Hello.&lt;/p&gt;
--   </pre>
--   
--   We support this in BlazeMarkup using this funcion. The above fragment
--   could be described using BlazeMarkup with:
--   
--   <pre>
--   p ! dataAttribute "foo" "bar" $ "Hello."
--   </pre>
dataAttribute :: Tag -> AttributeValue -> Attribute

-- | Create a custom attribute. This is not specified in the HTML spec, but
--   some JavaScript libraries rely on it.
--   
--   An example:
--   
--   <pre>
--   &lt;select dojoType="select"&gt;foo&lt;/select&gt;
--   </pre>
--   
--   Can be produced using:
--   
--   <pre>
--   select ! customAttribute "dojoType" "select" $ "foo"
--   </pre>
customAttribute :: Tag -> AttributeValue -> Attribute

-- | Class allowing us to use a single function for Markup values
class ToMarkup a where preEscapedToMarkup = toMarkup

-- | Convert a value to Markup.
toMarkup :: ToMarkup a => a -> Markup

-- | Convert a value to Markup without escaping
preEscapedToMarkup :: ToMarkup a => a -> Markup

-- | Render text. Functions like these can be used to supply content in
--   HTML.
text :: Text -> Markup

-- | Render text without escaping.
preEscapedText :: Text -> Markup

-- | A variant of <a>text</a> for lazy <a>Text</a>.
lazyText :: Text -> Markup

-- | A variant of <a>preEscapedText</a> for lazy <a>Text</a>
preEscapedLazyText :: Text -> Markup

-- | Create an HTML snippet from a <a>String</a>.
string :: String -> Markup

-- | Create an HTML snippet from a <a>String</a> without escaping
preEscapedString :: String -> Markup

-- | Insert a <a>ByteString</a>. This is an unsafe operation:
--   
--   <ul>
--   <li>The <a>ByteString</a> could have the wrong encoding.</li>
--   <li>The <a>ByteString</a> might contain illegal HTML characters (no
--   escaping is done).</li>
--   </ul>
unsafeByteString :: ByteString -> Markup

-- | Insert a lazy <a>ByteString</a>. See <a>unsafeByteString</a> for
--   reasons why this is an unsafe operation.
unsafeLazyByteString :: ByteString -> Markup

-- | Create a comment from a <a>Text</a> value. The text should not contain
--   <tt>"--"</tt>. This is not checked by the library.
textComment :: Text -> Markup

-- | Create a comment from a <a>Text</a> value. The text should not contain
--   <tt>"--"</tt>. This is not checked by the library.
lazyTextComment :: Text -> Markup

-- | Create a comment from a <a>String</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
stringComment :: String -> Markup

-- | Create a comment from a <a>ByteString</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
unsafeByteStringComment :: ByteString -> Markup

-- | Create a comment from a <a>ByteString</a> value. The text should not
--   contain <tt>"--"</tt>. This is not checked by the library.
unsafeLazyByteStringComment :: ByteString -> Markup

-- | Create a <a>Tag</a> from some <a>Text</a>.
textTag :: Text -> Tag

-- | Create a <a>Tag</a> from a <a>String</a>.
stringTag :: String -> Tag

-- | Class allowing us to use a single function for attribute values
class ToValue a where preEscapedToValue = toValue

-- | Convert a value to an attribute value
toValue :: ToValue a => a -> AttributeValue

-- | Convert a value to an attribute value without escaping
preEscapedToValue :: ToValue a => a -> AttributeValue

-- | Render an attribute value from <a>Text</a>.
textValue :: Text -> AttributeValue

-- | Render an attribute value from <a>Text</a> without escaping.
preEscapedTextValue :: Text -> AttributeValue

-- | A variant of <a>textValue</a> for lazy <a>Text</a>
lazyTextValue :: Text -> AttributeValue

-- | A variant of <a>preEscapedTextValue</a> for lazy <a>Text</a>
preEscapedLazyTextValue :: Text -> AttributeValue

-- | Create an attribute value from a <a>String</a>.
stringValue :: String -> AttributeValue

-- | Create an attribute value from a <a>String</a> without escaping.
preEscapedStringValue :: String -> AttributeValue

-- | Create an attribute value from a <a>ByteString</a>. See
--   <a>unsafeByteString</a> for reasons why this might not be a good idea.
unsafeByteStringValue :: ByteString -> AttributeValue

-- | Create an attribute value from a lazy <a>ByteString</a>. See
--   <a>unsafeByteString</a> for reasons why this might not be a good idea.
unsafeLazyByteStringValue :: ByteString -> AttributeValue

-- | Apply an attribute to an element.
--   
--   Example:
--   
--   <pre>
--   img ! src "foo.png"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   &lt;img src="foo.png" /&gt;
--   </pre>
--   
--   This can be used on nested elements as well.
--   
--   Example:
--   
--   <pre>
--   p ! style "float: right" $ "Hello!"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   &lt;p style="float: right"&gt;Hello!&lt;/p&gt;
--   </pre>
(!) :: Attributable h => h -> Attribute -> h

-- | Shorthand for setting an attribute depending on a conditional.
--   
--   Example:
--   
--   <pre>
--   p !? (isBig, A.class "big") $ "Hello"
--   </pre>
--   
--   Gives the same result as:
--   
--   <pre>
--   (if isBig then p ! A.class "big" else p) "Hello"
--   </pre>
(!?) :: Attributable h => h -> (Bool, Attribute) -> h

-- | Take only the text content of an HTML tree.
--   
--   <pre>
--   contents $ do
--       p ! $ "Hello "
--       p ! $ "Word!"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   Hello World!
--   </pre>
contents :: MarkupM a -> MarkupM b
instance Text.Blaze.ToMarkup Text.Blaze.Internal.Markup
instance Text.Blaze.ToMarkup [Text.Blaze.Internal.Markup]
instance Text.Blaze.ToMarkup Data.Text.Internal.Text
instance Text.Blaze.ToMarkup Data.Text.Internal.Lazy.Text
instance Text.Blaze.ToMarkup GHC.Base.String
instance Text.Blaze.ToMarkup GHC.Types.Int
instance Text.Blaze.ToMarkup GHC.Int.Int32
instance Text.Blaze.ToMarkup GHC.Int.Int64
instance Text.Blaze.ToMarkup GHC.Types.Char
instance Text.Blaze.ToMarkup GHC.Types.Bool
instance Text.Blaze.ToMarkup GHC.Integer.Type.Integer
instance Text.Blaze.ToMarkup GHC.Types.Float
instance Text.Blaze.ToMarkup GHC.Types.Double
instance Text.Blaze.ToMarkup GHC.Types.Word
instance Text.Blaze.ToMarkup GHC.Word.Word32
instance Text.Blaze.ToMarkup GHC.Word.Word64
instance Text.Blaze.ToValue Text.Blaze.Internal.AttributeValue
instance Text.Blaze.ToValue Data.Text.Internal.Text
instance Text.Blaze.ToValue Data.Text.Internal.Lazy.Text
instance Text.Blaze.ToValue GHC.Base.String
instance Text.Blaze.ToValue GHC.Types.Int
instance Text.Blaze.ToValue GHC.Int.Int32
instance Text.Blaze.ToValue GHC.Int.Int64
instance Text.Blaze.ToValue GHC.Types.Char
instance Text.Blaze.ToValue GHC.Types.Bool
instance Text.Blaze.ToValue GHC.Integer.Type.Integer
instance Text.Blaze.ToValue GHC.Types.Float
instance Text.Blaze.ToValue GHC.Types.Double
instance Text.Blaze.ToValue GHC.Types.Word
instance Text.Blaze.ToValue GHC.Word.Word32
instance Text.Blaze.ToValue GHC.Word.Word64
