Created
April 19, 2011 15:58
-
-
Save bitonic/928585 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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