Skip to content

Instantly share code, notes, and snippets.

@bitonic
Created April 19, 2011 15:58
Show Gist options
  • Save bitonic/928585 to your computer and use it in GitHub Desktop.
Save bitonic/928585 to your computer and use it in GitHub Desktop.
{-# OPTIONS_GHC -F -pgmFtrhsx #-}
module Main (main) where
import Control.Monad
import Happstack.Server
import qualified Text.Blaze.Html5 as H
import Data.String (fromString)
import HSP
import qualified HSX.XMLGenerator as HSX
import Happstack.Server.HSP.HTML ()
import HSP.ServerPartT ()
fs = fromString
main :: IO ()
main = simpleHTTP nullConf $ msum
[ dir "simple" $ ok $ toResponse "Hello, World!"
, dir "blaze" $ ok $ toResponse $
H.html $ do
H.head $ do
H.title (fs "Test page")
H.body $ do
H.h1 (fs "Hello world!")
H.div $ do
H.span (fs "blaze test page.")
, dir "hsp" (hspHtml >>= ok . toResponse)
]
where
hspHtml =
unXMLGenT $
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>Hello world!</h1>
<div>
<span>hsp test page</span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment