<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Blaze</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Text-Blaze.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-Blaze.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">blaze-html-0.4.1.3: A blazingly fast HTML combinator library.</p></div><div id="content"><div id="module-header"><p class="caption">Text.Blaze</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Important types. </a></li><li><a href="#g:2">Creating attributes. </a></li><li><a href="#g:3">Converting values to HTML. </a></li><li><a href="#g:4">Creating tags. </a></li><li><a href="#g:5">Converting values to attribute values. </a></li><li><a href="#g:6">Setting attributes </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>BlazeHtml is an HTML combinator library. It provides a way to embed HTML in Haskell in an efficient and convenient way, with a light-weight syntax. </p><p>To use the library, one needs to import a set of HTML combinators. For example, you can use HTML 4 Strict. </p><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><p>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. </p><pre> import Text.Blaze.Renderer.Utf8 (renderHtml) </pre><p>Now, you can describe pages using the imported combinators. </p><pre> page1 :: Html 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 BlazeHtml syntax." ul $ forM_ [1, 2, 3] (li . string . show) </pre><p>The resulting HTML can now be extracted using: </p><pre> renderHtml page1 </pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">type</span> <a href="#t:Html">Html</a> = <a href="Text-Blaze-Internal.html#t:HtmlM">HtmlM</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Tag">Tag</a> </li><li class="src short"><span class="keyword">data</span> <a href="#t:Attribute">Attribute</a> </li><li class="src short"><span class="keyword">data</span> <a href="#t:AttributeValue">AttributeValue</a> </li><li class="src short"><a href="#v:dataAttribute">dataAttribute</a> :: <a href="Text-Blaze.html#t:Tag">Tag</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a> -> <a href="Text-Blaze.html#t:Attribute">Attribute</a></li><li class="src short"><a href="#v:customAttribute">customAttribute</a> :: <a href="Text-Blaze.html#t:Tag">Tag</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a> -> <a href="Text-Blaze.html#t:Attribute">Attribute</a></li><li class="src short"><span class="keyword">class</span> <a href="#t:ToHtml">ToHtml</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:toHtml">toHtml</a> :: a -> <a href="Text-Blaze.html#t:Html">Html</a></li></ul></li><li class="src short"><a href="#v:text">text</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:preEscapedText">preEscapedText</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:lazyText">lazyText</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:preEscapedLazyText">preEscapedLazyText</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:string">string</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:preEscapedString">preEscapedString</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:unsafeByteString">unsafeByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:unsafeLazyByteString">unsafeLazyByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Text-Blaze.html#t:Html">Html</a></li><li class="src short"><a href="#v:textTag">textTag</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:Tag">Tag</a></li><li class="src short"><a href="#v:stringTag">stringTag</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:Tag">Tag</a></li><li class="src short"><span class="keyword">class</span> <a href="#t:ToValue">ToValue</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:toValue">toValue</a> :: a -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li></ul></li><li class="src short"><a href="#v:textValue">textValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:preEscapedTextValue">preEscapedTextValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:lazyTextValue">lazyTextValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:preEscapedLazyTextValue">preEscapedLazyTextValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:stringValue">stringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:preEscapedStringValue">preEscapedStringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:unsafeByteStringValue">unsafeByteStringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:unsafeLazyByteStringValue">unsafeLazyByteStringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></li><li class="src short"><a href="#v:-33-">(!)</a> :: Attributable h => h -> <a href="Text-Blaze.html#t:Attribute">Attribute</a> -> h</li></ul></div><div id="interface"><h1 id="g:1">Important types. </h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Html" class="def">Html</a> = <a href="Text-Blaze-Internal.html#t:HtmlM">HtmlM</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Text-Blaze-Internal.html#Html" class="link">Source</a></p><div class="doc"><p>Simplification of the <code><a href="Text-Blaze-Internal.html#t:HtmlM">HtmlM</a></code> datatype. </p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Tag" class="def">Tag</a> <a href="src/Text-Blaze-Internal.html#Tag" class="link">Source</a></p><div class="doc"><p>Type for an HTML tag. This can be seen as an internal string type used by BlazeHtml. </p></div><div class="subs instances"><p id="control.i:Tag" class="caption collapser" onclick="toggleSection('i:Tag')">Instances</p><div id="section.i:Tag" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-String.html#t:IsString">IsString</a> <a href="Text-Blaze.html#t:Tag">Tag</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Attribute" class="def">Attribute</a> <a href="src/Text-Blaze-Internal.html#Attribute" class="link">Source</a></p><div class="doc"><p>Type for an attribute. </p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:AttributeValue" class="def">AttributeValue</a> <a href="src/Text-Blaze-Internal.html#AttributeValue" class="link">Source</a></p><div class="doc"><p>The type for the value part of an attribute. </p></div><div class="subs instances"><p id="control.i:AttributeValue" class="caption collapser" onclick="toggleSection('i:AttributeValue')">Instances</p><div id="section.i:AttributeValue" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-String.html#t:IsString">IsString</a> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:2">Creating attributes. </h1><div class="top"><p class="src"><a name="v:dataAttribute" class="def">dataAttribute</a><a href="src/Text-Blaze-Internal.html#dataAttribute" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Text-Blaze.html#t:Tag">Tag</a></td><td class="doc"><p>Name of the attribute. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Value for the attribute. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Attribute">Attribute</a></td><td class="doc"><p>Resulting HTML attribute. </p></td></tr></table></div><div class="doc"><p>From HTML 5 onwards, the user is able to specify custom data attributes. </p><p>An example: </p><pre> <p data-foo="bar">Hello.</p> </pre><p>We support this in BlazeHtml using this funcion. The above fragment could be described using BlazeHtml with: </p><pre> p ! dataAttribute "foo" "bar" $ "Hello." </pre></div></div><div class="top"><p class="src"><a name="v:customAttribute" class="def">customAttribute</a><a href="src/Text-Blaze-Internal.html#customAttribute" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Text-Blaze.html#t:Tag">Tag</a></td><td class="doc"><p>Name of the attribute </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Value for the attribute </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Attribute">Attribute</a></td><td class="doc"><p>Resulting HTML attribtue </p></td></tr></table></div><div class="doc"><p>Create a custom attribute. This is not specified in the HTML spec, but some JavaScript libraries rely on it. </p><p>An example: </p><pre> <select dojoType="select">foo</select> </pre><p>Can be produced using: </p><pre> select ! customAttribute "dojoType" "select" $ "foo" </pre></div></div><h1 id="g:3">Converting values to HTML. </h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:ToHtml" class="def">ToHtml</a> a <span class="keyword">where</span><a href="src/Text-Blaze.html#ToHtml" class="link">Source</a></p><div class="doc"><p>Class allowing us to use a single function for HTML values </p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:toHtml" class="def">toHtml</a> :: a -> <a href="Text-Blaze.html#t:Html">Html</a><a href="src/Text-Blaze.html#toHtml" class="link">Source</a></p><div class="doc"><p>Convert a value to HTML. </p></div></div><div class="subs instances"><p id="control.i:ToHtml" class="caption collapser" onclick="toggleSection('i:ToHtml')">Instances</p><div id="section.i:ToHtml" class="show"><table><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:Char">Char</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Float">Float</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToHtml">ToHtml</a> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:text" class="def">text</a><a href="src/Text-Blaze-Internal.html#text" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc"><p>Text to render. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment. </p></td></tr></table></div><div class="doc"><p>Render text. Functions like these can be used to supply content in HTML. </p></div></div><div class="top"><p class="src"><a name="v:preEscapedText" class="def">preEscapedText</a><a href="src/Text-Blaze-Internal.html#preEscapedText" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc"><p>Text to insert </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment </p></td></tr></table></div><div class="doc"><p>Render text without escaping. </p></div></div><div class="top"><p class="src"><a name="v:lazyText" class="def">lazyText</a><a href="src/Text-Blaze-Internal.html#lazyText" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc"><p>Text to insert </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment </p></td></tr></table></div><div class="doc"><p>A variant of <code><a href="Text-Blaze.html#v:text">text</a></code> for lazy <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:preEscapedLazyText" class="def">preEscapedLazyText</a><a href="src/Text-Blaze-Internal.html#preEscapedLazyText" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc"><p>Text to insert </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment </p></td></tr></table></div><div class="doc"><p>A variant of <code><a href="Text-Blaze.html#v:preEscapedText">preEscapedText</a></code> for lazy <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></code> </p></div></div><div class="top"><p class="src"><a name="v:string" class="def">string</a><a href="src/Text-Blaze-Internal.html#string" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p>String to insert. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment. </p></td></tr></table></div><div class="doc"><p>Create an HTML snippet from a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:preEscapedString" class="def">preEscapedString</a><a href="src/Text-Blaze-Internal.html#preEscapedString" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p>String to insert. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment. </p></td></tr></table></div><div class="doc"><p>Create an HTML snippet from a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code> without escaping </p></div></div><div class="top"><p class="src"><a name="v:unsafeByteString" class="def">unsafeByteString</a><a href="src/Text-Blaze-Internal.html#unsafeByteString" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Value to insert. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment. </p></td></tr></table></div><div class="doc"><p>Insert a <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code>. This is an unsafe operation: </p><ul><li> The <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code> could have the wrong encoding. </li><li> The <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code> might contain illegal HTML characters (no escaping is done). </li></ul></div></div><div class="top"><p class="src"><a name="v:unsafeLazyByteString" class="def">unsafeLazyByteString</a><a href="src/Text-Blaze-Internal.html#unsafeLazyByteString" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>Value to insert </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Html">Html</a></td><td class="doc"><p>Resulting HTML fragment </p></td></tr></table></div><div class="doc"><p>Insert a lazy <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>. See <code><a href="Text-Blaze.html#v:unsafeByteString">unsafeByteString</a></code> for reasons why this is an unsafe operation. </p></div></div><h1 id="g:4">Creating tags. </h1><div class="top"><p class="src"><a name="v:textTag" class="def">textTag</a><a href="src/Text-Blaze-Internal.html#textTag" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc"><p>Text to create a tag from </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Tag">Tag</a></td><td class="doc"><p>Resulting tag </p></td></tr></table></div><div class="doc"><p>Create a <code><a href="Text-Blaze.html#t:Tag">Tag</a></code> from some <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:stringTag" class="def">stringTag</a><a href="src/Text-Blaze-Internal.html#stringTag" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc"><p>String to create a tag from </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:Tag">Tag</a></td><td class="doc"><p>Resulting tag </p></td></tr></table></div><div class="doc"><p>Create a <code><a href="Text-Blaze.html#t:Tag">Tag</a></code> from a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code>. </p></div></div><h1 id="g:5">Converting values to attribute values. </h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:ToValue" class="def">ToValue</a> a <span class="keyword">where</span><a href="src/Text-Blaze.html#ToValue" class="link">Source</a></p><div class="doc"><p>Class allowing us to use a single function for attribute values </p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:toValue" class="def">toValue</a> :: a -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a><a href="src/Text-Blaze.html#toValue" class="link">Source</a></p><div class="doc"><p>Convert a value to an HTML attribute value </p></div></div><div class="subs instances"><p id="control.i:ToValue" class="caption collapser" onclick="toggleSection('i:ToValue')">Instances</p><div id="section.i:ToValue" class="show"><table><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:Char">Char</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Float">Float</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Blaze.html#t:ToValue">ToValue</a> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:textValue" class="def">textValue</a><a href="src/Text-Blaze-Internal.html#textValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc"><p>The actual value. </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value. </p></td></tr></table></div><div class="doc"><p>Render an attribute value from <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:preEscapedTextValue" class="def">preEscapedTextValue</a><a href="src/Text-Blaze-Internal.html#preEscapedTextValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></td><td class="doc"><p>The actual value </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value </p></td></tr></table></div><div class="doc"><p>Render an attribute value from <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a></code> without escaping. </p></div></div><div class="top"><p class="src"><a name="v:lazyTextValue" class="def">lazyTextValue</a><a href="src/Text-Blaze-Internal.html#lazyTextValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc"><p>The actual value </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value </p></td></tr></table></div><div class="doc"><p>A variant of <code><a href="Text-Blaze.html#v:textValue">textValue</a></code> for lazy <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></code> </p></div></div><div class="top"><p class="src"><a name="v:preEscapedLazyTextValue" class="def">preEscapedLazyTextValue</a><a href="src/Text-Blaze-Internal.html#preEscapedLazyTextValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></td><td class="doc"><p>The actual value </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value </p></td></tr></table></div><div class="doc"><p>A variant of <code><a href="Text-Blaze.html#v:preEscapedTextValue">preEscapedTextValue</a></code> for lazy <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Lazy-Internal.html#t:Text">Text</a></code> </p></div></div><div class="top"><p class="src"><a name="v:stringValue" class="def">stringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a><a href="src/Text-Blaze-Internal.html#stringValue" class="link">Source</a></p><div class="doc"><p>Create an attribute value from a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:preEscapedStringValue" class="def">preEscapedStringValue</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a><a href="src/Text-Blaze-Internal.html#preEscapedStringValue" class="link">Source</a></p><div class="doc"><p>Create an attribute value from a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code> without escaping. </p></div></div><div class="top"><p class="src"><a name="v:unsafeByteStringValue" class="def">unsafeByteStringValue</a><a href="src/Text-Blaze-Internal.html#unsafeByteStringValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>ByteString value </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value </p></td></tr></table></div><div class="doc"><p>Create an attribute value from a <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code>. See <code><a href="Text-Blaze.html#v:unsafeByteString">unsafeByteString</a></code> for reasons why this might not be a good idea. </p></div></div><div class="top"><p class="src"><a name="v:unsafeLazyByteStringValue" class="def">unsafeLazyByteStringValue</a><a href="src/Text-Blaze-Internal.html#unsafeLazyByteStringValue" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>ByteString value </p></td></tr><tr><td class="src">-> <a href="Text-Blaze.html#t:AttributeValue">AttributeValue</a></td><td class="doc"><p>Resulting attribute value </p></td></tr></table></div><div class="doc"><p>Create an attribute value from a lazy <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>. See <code><a href="Text-Blaze.html#v:unsafeByteString">unsafeByteString</a></code> for reasons why this might not be a good idea. </p></div></div><h1 id="g:6">Setting attributes </h1><div class="top"><p class="src"><a name="v:-33-" class="def">(!)</a> :: Attributable h => h -> <a href="Text-Blaze.html#t:Attribute">Attribute</a> -> h<a href="src/Text-Blaze-Internal.html#%21" class="link">Source</a></p><div class="doc"><p>Apply an attribute to an element. </p><p>Example: </p><pre> img ! src "foo.png" </pre><p>Result: </p><pre> <img src="foo.png" /> </pre><p>This can be used on nested elements as well. </p><p>Example: </p><pre> p ! style "float: right" $ "Hello!" </pre><p>Result: </p><pre> <p style="float: right">Hello!</p> </pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>