I am working through the blaze-html tutorial. I just want a simple Hello World page.
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text
notes :: Html
notes = docTypeHtml $ do
H.head $ do
H.title "John´ s Page"
body $ do
p "Hello World!"
Where is it? How do I get my HTML? Can I just print it to the terminal or a file? That would be a great start.
<html>
<head><title>John's Page</title></head>
<body><p>Hello World!</p></body>
</html>
And are all the import statements really necessary? I just want it to work.
I tried printing using the renderHTML
function but I just get an error message:
main = (renderHtml notes) >>= putStrLn
notes.hs:21:9:
Couldn't match expected type `IO String'
with actual type `Data.Text.Internal.Lazy.Text'
In the return type of a call of `renderHtml'
In the first argument of `(>>=)', namely `(renderHtml notes)'
In the expression: (renderHtml notes) >>= putStrLn