blaze -is:package

Write some Html as response
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.
{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (head, id, div)
import Text.Blaze.Html4.Strict hiding (map)
import Text.Blaze.Html4.Strict.Attributes hiding (title)
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.
import Text.Blaze.Renderer.Utf8 (renderMarkup)
Now, you can describe pages using the imported combinators.
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]
The resulting HTML can now be extracted using:
renderMarkup page1
An HTML empty data type with MimeRender instances for blaze-html's ToMarkup class and Html datatype. You should only need to import this module for its instances and the HTML datatype:
>>> type Eg = Get '[HTML] a
Will then check that a has a ToMarkup instance, or is Html.
HTML writing helpers using blaze-html.
Plot traces to html using blaze-html Example code:
plotHtml :: Html ()
plotHtml = toHtml $ plotly "myDiv" [trace] & layout . title ?~ "my plot"
& layout . width ?~ 300
where trace is a value of type Trace
Since 0.1.0.0
Send Emails templated with Blaze using SES
main :: IO ()
main = print =<< sendEmailBlaze publicKey secretKey region from to subject html
where
publicKey = PublicKey "public key goes here"
secretKey = SecretKey "secret key goes here"
region    = USEast1
from    = "verifiedSender@domain.com"
to      = ["recipient@domain.com"]
subject = "Test Subject"
html = H.html $ do
H.body $ do
H.h1 "Html email!"