module Main where
import Happstack.Lite
import Text.Html
main :: IO ()
main = serve Nothing $ msum [
nullDir >> ok homePage
, notFound page404
]
homePage :: Response
homePage = toResponse $ do
p (toHtml "hello") +++
strong (toHtml "BOLD")
page404 :: Response
page404 = toResponse "<strong>How do I parse the tag STRONG?</strong>"
Hi, I'm new to happstack. I'm wondering if there's a way I can just display a string with html tags as response instead of using a html template library?
In the above code, the <strong>
tag in page404 is escaped, so I got "<strong>How do I pase the tag BOLD?</strong>
" as response, while the one homePage is rendered as "How do I parse the tag BOLD".
Do I have to parse the string first? But wouldn't that be too slow if the html string is large?
Thanks in advance.